Forum Discussion
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
}
}
}
`
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
}
}
}
1 Reply
- Ed_Summers
Nimbostratus
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.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
