Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

Simple -iRule with URI not behaving as expected

when HTTP_REQUEST { switch -glob [HTTP::uri] {

 "/api*" -
  "/API*" {
              pool pool-XYZ
          }
"/style*" -
"/help*" -
     default  {
              pool pool-AMC
              }
       }
}
`</pre>

I have above iRule on HTTPS VIP . when I used URL to access the VIP output as below
[https://google.com/main_page/API/](https://google.com/main_page/API/) 
 ******This is showing 404 page not found[expected output]

[https://google.com/main_page/API/style](https://google.com/main_page/API/style) This is showing 404 page not found [expected output]


**[https://google.com/main_page/API/Help](https://google.com/main_page/API/Help) - This is showing Help page but our requirement is to show 404 page not found  [[Not working as expected]**

Will My Below Modified Rule works Fine to resolve this /help issue???

when HTTP_REQUEST { switch -glob [HTTP::uri] { 

"/api*" -

"/API*" {
                    pool pool-XYZ
          }

"/style*" -

"/help*" { 
                    HTTP::respond 404 content "Page_not_Found" 

          }

default  {
                    pool pool-AMC
           }

  }

}

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

I'm having a little trouble reading due to the way the formatting came through, but one thing that stands out is that the case is different between your test and the actual request.

Your test uses /Help (upper-case 'H'), while the test is all lower-case.

You could change the case in your test to match the expected input, or use the tcl 'string tolower' function to convert the input to all lower-case first, then test based on lower-case. Which method you use depends on how you need to handle expected inputs and preference.

0