Forum Discussion
John_LeMay_1062
Nimbostratus
Dec 19, 2005Another uri rewrite question
I'm trying to write a simple iRule to check for a blank uri and replace it with "/string". It is possible there would be valid uri's passed (/string2 for example), so I only want to add "/string" if t...
Dec 19, 2005
I don't see any reason why your rule wouldn't work, but there is a bunch of extra code that you really don't need to be running.
For your port 80 virtual, the HTTP::uri command is a no-op since you are using a redirect right after it. I'd change that rule to this:
when HTTP_REQUEST {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
And for your 443 virtual, you can combine your two equals statements into one with a string length command and only reset the URI if your condition is met.
when HTTP_REQUEST {
if { [string length [HTTP::uri]] <= 1 } {
HTTP::uri "/string"
}
}
Try this out and see if it works. If not, I'd suggest throwing in some logging to give you an idea as to what's going wrong.
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects