Forum Discussion

ramann_75062's avatar
ramann_75062
Icon for Nimbostratus rankNimbostratus
Apr 22, 2009

Regex for URI Path List

Hi@all,

 

 

i like to create two application security classes for a virtual server, the first one have a URI path like /cgi-bin and die second one should use the rest - expect cgi-bin.

 

 

my idea is to use a regex who matche everything which is not starting with /cgi-bin/

 

 

regex:

 

 

^(!/cgi-bin/)

 

 

But this doesn't work.

 

 

Any idea what is wrong with my expression?

 

 

 

thanks

 

Bjoern

2 Replies

  • Hi Bjoern,

     

     

    You can use a regex like this to match anything not starting with /cgi-bin/

     

     

    http://devcentral.f5.com/Default.aspx?tabid=53&forumid=31&tpage=1&view=topic&postid=27773

     

     

    (?i)^(?!/cgi-bin/).*$

     

     

    Aaron
  • Tom_Spector_50's avatar
    Tom_Spector_50
    Historic F5 Account
    if you have the class catching the /cgi-bin/ as the first class in the list, then anything not caught by it will be processed by the second class - no need to actually define a specific regexp for it.

     

    Note that there are various ways to make requests containing cgi-bin so make your regexp catch all of them (e.g. /dir1/../../cgi-bin/) also, if you want these requests to be dropped, you will need to have no pool on the class and no pool on the VS (the pool will be configured on the second class that processes the traffic). Another option would be to have a redirect to the homepage on the cgi-bin class.

     

     

    Thanks,

     

     

    Tom.