Forum Discussion
BIG-IP : irule not matching uri as expected
F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi
This code is logging all requests - including those with uri "/404" :
when HTTP_REQUEST {
if {[HTTP::uri] != "/404"} {
log local0. "uri = [HTTP::uri]"
}
}Where is my mistake ?
9 Replies
- Sriram_87174
Nimbostratus
Are you trying to log the 404 error in the response packet? try using when HTTP_RESPONSE function and see if you can log 404 error.
- /404 is a uri not a response error
- Sriram_87174
Nimbostratus
You can try using HTTP::path instead of HTTP::uri when HTTP_REQUEST { if {[HTTP::path] != "/404"} { log local0. "uri = [HTTP::uri]" } } - Sriram_87174
Nimbostratus
I tried with both HTTP::path and HTTP::uri - It works fine. i am using v11.4.1 BIG IP appliance.
- arpydays
Nimbostratus
does the logged /404 uri match exactly /404 as per your irule or does it start with or contain /404 i.e. /404/
cheers
- arpydays
Nimbostratus
not sure what's going on then - I'm using 11.6 VE, prehaps you can run the same commands and post your results
ltm rule test404 { when HTTP_REQUEST { if {[HTTP::uri] != "/404"} { log local0. "uri = [HTTP::uri]" } } } [root@f5lab] config curl http://10.12.12.145/402 [root@f5lab] config curl http://10.12.12.145/403 [root@f5lab] config curl http://10.12.12.145/404 [root@f5lab] config curl http://10.12.12.145/405 Sep 18 16:43:00 f5lab info tmm[17994]: Rule /Common/test404 : uri = /402 Sep 18 16:43:05 f5lab info tmm[17994]: Rule /Common/test404 : uri = /403 Sep 18 16:43:11 f5lab info tmm[17994]: Rule /Common/test404 : uri = /405 Try using ne instead of !=. You may be having an issue with data type conversion. Using ne will ensure you are doing a string comparison. I'm not positive that is the issue, but it's an easy change to test.
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