Forum Discussion
slomah_85788
Nimbostratus
Jun 10, 2009Appending iRule
Hi,
I have requested to create iRule which will add appending to url, as the customer will write (http://mycompany.com ) and the application won’t work unless you write the following (http://m...
hoolio
Cirrostratus
Jun 15, 2009If you just want to rewrite requests to the root document (path equals /), you could use this:
when HTTP_REQUEST {
Check if path is /
if {[HTTP::path] eq "/"}{
Rewrite path to /test/app.aspx
HTTP::path "/test/app.aspx"
}
}
If you want to prepend a string to all URIs if it's not there already, you can use a rule like this:
when HTTP_REQUEST {
Check if path doesn't already start with /test/
if { not ([HTTP::path] starts_with "/test/")}{
Rewrite path by prepending "/test/"
HTTP::path "/test/[HTTP::path]"
}
}
Note that if you don't care about inspecting the query string it should be more efficient to modify just the path using HTTP::path.
Aaron
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