Forum Discussion

cymru81's avatar
cymru81
Icon for Altocumulus rankAltocumulus
Nov 01, 2021

Filter request irule

Hi, is it possible to use an irule to block access (or redirect to a different address) if https://www.abc.com or https://www.abc.com/ was visited but still allow access to https://www.abc.com/123/ and any other sub-directories?

  • You can follow 2 approaches.

    Neagtive Security - Allows everything, and reject what I know

    when HTTP_REQUEST {
    	 switch -glob [HTTP::uri] {
                    "/" -
    		"/abc"
    		{
                          reject
    		} 
    		default {
    		       return
    		}
    	}
    }

    Positive Security - Rejects everything and allow only what I know

    when HTTP_REQUEST {
    	 switch -glob [HTTP::uri] {
                    "/123*" -
    		"/234*"
    		{
                        return
    		} 
    		 default {
    		        drop
    		}
    	}
    }