Forum Discussion

rezgui_180607's avatar
rezgui_180607
Icon for Nimbostratus rankNimbostratus
Dec 24, 2014

incorrect condifiton if

the previews version

 

if { $http_path contains ".jsp" } { drop }

 

the new version i add class

 

if { $http_path contains ".jsp" && [class match $http_path not contains class_jsp_allowed] } { drop }

 

but its incorrect how can i correct this the errer message parse error: missing close-brace: possible unbalanced brace in comment] [{ set http_path [URI::decode [string tolower [HTTP::path]]] Custom 403 denied access page set html_error_message_head { <

 

i need to use class and with the condition $http_path contains ".jsp" thanks in advance

 

4 Replies

  • i get a different error, don't believe you can do "not contains" so that probably becomes ![ ... ]

     

    are you sure the error you get is caused by this line itself, not the context?

     

  • e.g.

    root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux
    ltm rule qux {
        when HTTP_REQUEST {
      set http_path [HTTP::path]
      if { $http_path contains ".jsp" && not([class match $http_path contains class_jsp_allowed]) } {
        drop
      }
    }
    }
    
  • so not contains will be (!contains) is that correct

     

    ($http_path contains ".jsp" && $http_path ! contains "sample.jsp" )