Forum Discussion
Irule exclude url and redirect problem
Origianal Irule as below will filter "/support" string, I want add another one but looks like it's not working. I appreciate if anyone can help :)
when HTTP_REQUEST { if { not ([string tolower [HTTP::uri]] starts_with "/support") } { HTTP::respond 301 Location "http://www.test.com" } }
I changed as below:
when HTTP_REQUEST { if { not ([string tolower [HTTP::uri]] starts_with "/support") or not ([string tolower [HTTP::path]] equals "/about-uss/sage-trustwave-pci-compliance" ) } { HTTP::respond 301 Location "http://www.test.com" } }
4 Replies
Hi Paulguo,
try this snipped...
set low_uri [string tolower [HTTP::uri]] if {( $low_uri starts_with "/support") or ( $low_uri equals "/about-uss/sage-trustwave-pci-compliance" ) } then { Do nothing } else { HTTP::respond 301 Location "http://www.test.com" }Cheers, Kai
Hi Paulguo,
try this snipped...
set low_uri [string tolower [HTTP::uri]] if {( $low_uri starts_with "/support") or ( $low_uri equals "/about-uss/sage-trustwave-pci-compliance" ) } then { Do nothing } else { HTTP::respond 301 Location "http://www.test.com" }Cheers, Kai
Hi Paulguo,
if you want to avoid the empty "then" clause, then try this snipped...
set low_uri [string tolower [HTTP::uri]] if { not ( ( $low_uri starts_with "/support") or ( $low_uri equals "/about-uss/sage-trustwave-pci-compliance" ) ) } then { HTTP::respond 301 Location "http://www.test.com" }BTW: Using the first or second example only depends on your prefered coding style, while providing the same functionality without any noticable performance impacts/gains^^
BTW2: Putting the low_uri into a variable will save some CPU cycles if evaluated more than once^^
HTH, -Kai
- paulguo_152257
Nimbostratus
Thank you Wilke, I will test on my device.
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