Kemp Support, how can we help?

The latest application delivery knowledge and expertise at your fingertips.

Content rule to block multiple URLs





This article outlines a solution for blocking multiple defined URLs and allowing all other URLs, using a single content rule.


Product: LoadMaster

Version: Any

Platform: Any

Application: Any

Question/Problem Description:

How to block multiple specific URLs on the LoadMaster using a single content rule?

Steps to Reproduce:  
Error Message:  
Defect Number:  
Enhancement Number:  

Below is an example syntax for a content rule that blocks the root domain URLs ($ and /), and two specific URLs (/url1 and /url2). This can be scaled up or down as required by adding more brackets () with the pipe | in between to act as an OR statement.


Rule Name:    block_urls
Rule Type:   Content Matching
Match Type:   Regular Expression
Header Field:   <empty>
Match String:   /^(($)|(\/$)|(\/url1$)|(\/url2\/$))/
Negation:   False
Ignore Case:   True
Include Host in URL:   False
Include Query in URL:   False
Fail On Match:   True


After creating the above content rule, it is then necessary to apply it under a Virtual Service or Sub Virtual Service (SubVS) as a HTTP Selection rule under Advanced Properties

Then under the same Advanced Properties, set the Not Available Redirection Handling to 403 Forbidden and set an error message.

Now test the URLs defined in the rule string above and all should return the 403 error message. Any other URL should be allowed and proceed the display the correct content.


Content Rules Guide:


Was this article helpful?
0 out of 0 found this helpful