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

YannickWorldline's avatar
YannickWorldline
Icon for Nimbostratus rankNimbostratus
Mar 26, 2025

Multiple http_request event with http::respond

Hello, 
I need to make two iRules on the same VS. The two are http_request triggered events with http::respond.

When I'm doing this it's making a conflict between them.

One is working well and the other one is working until it need to send me the http::respond instead of sending me the page I choose the client side receive an error "This site can’t be reached" in the browser side.

 

Is there a solution to this ?


Thanks :)

6 Replies

  • If you can could provide the two iRules we might be able to assist you with your issue.

    • YannickWorldline's avatar
      YannickWorldline
      Icon for Nimbostratus rankNimbostratus
      when HTTP_REQUEST {
          set max_requests 200
          set cookie [HTTP::cookie "SPECIAL_COOKIE"]
          set timeout_delay 30
      
          if { $cookie ne ""} {
              set request_count [table incr session_count:$cookie 1]
      
              if { $request_count == 1 } {
                  table set session_count:$cookie $request_count $timeout_delay
              }
              if { $request_count > $max_requests } {
                  set remaining_time [table timeout session_count:$cookie]
                  HTTP::respond 429 content "Request limit exceeded wait for $timeout_delay seconds. \nFor cookie: $cookie"
              }
          }
      }
      when HTTP_REQUEST {
          if { [HTTP::uri] contains "/XXXX/XXXXXXXXXXXXX" 
              or [HTTP::uri] contains "/XXXXXXXXXXXXXX/XX" 
              or [HTTP::uri] contains "/XXXXX/XXXX" 
              or [HTTP::uri] contains "/XXXXX/XXXX" 
      		or [HTTP::uri] contains "/XXXXXXXXX"
      		or [HTTP::uri] matches_regex {^/XXXXX.*\.XXXX$}}
          {
              set Custom_blocking_page [ifile get "/XXXXXXX"]
              HTTP::respond 410 content $Custom_blocking_page
              return
      	} return
      }

      This is the two iRule I have