For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

kgaigl's avatar
kgaigl
Icon for Cirrocumulus rankCirrocumulus
Oct 20, 2025

IRule to block different combinations host/uri

hello together,

we've got a VIP with a lot of CNAME's and a few login-URI's should be blocked, but not all.

so in our Irule we have some Entries like:

 elseif { [HTTP::uri] starts_with "/presse/login"}
		 {
			HTTP::respond 403 

but now we need special Combinations of 

[HTTP::host][HTTP::uri]

could you pls provide me some Example?

I'm not sure if [HTTP::host] matches alo for HTTPS.

Thank you

Karl

1 Reply

  • hi kgaigl​ 

    yes you can use [HTTP::host] for https too

    You should though better use switch instead of if
    check this https://clouddocs.f5.com/api/irules/switch.html

    and this is an example

    when HTTP_REQUEST 
    {
    	switch -- [string tolower [HTTP::host]] 
    	{
    		"www.example.com" -
    		"test.example.com" 
    		{
    			switch -glob -- [string tolower [HTTP::path]] 
    			{
    				"/presse/login*"
    				{
    					HTTP::respond 403
    				}
    			}
    			default 
    			{
    				log local0. "Hit default for [HTTP::path]]"
    			}
    		}
    		"abc.example.com"
    		{
    			log local0. "Hit rule for [HTTP::host]]"
    		}
    		default 
    		{
    			log local0. "Hit default for [HTTP::host]]"
    		}
    	}
    }