Forum Discussion
Append a URI to a Host via iRule
I have an iRule that is currently set up to look at the host name and uri to determine pool redirection. The customer would like that changed to append the URI /testing when the HOST is . My thought is that an HTTP redirect will just cause the request to exit out of the iRule and come back through again thus executing the iRule for a second time. I would like to just rewrite the URL to and pass it back to the associated pool.
when HTTP_REQUEST {
if { [HTTP::host] equals "www.testing.com" } {
append URI /testing
pool TESTING_POOL
}
}
Any help would be greatly appreciated.
3 Replies
- fgf_165674
Nimbostratus
Hello,
You can set the URI in the iRule with the command HTTP::uri,
HTTP::uri "/testing"
Regards,
- Vijay_E
Cirrus
Try this:
if { [HTTP::host] equals "www.testing.com" } { HTTP::uri [HTTP::uri]testing pool TESTING_POOL } - Stanislas_Piro2
Cumulonimbus
Hi,
rewrite uri only if necessary.
if you rewrite /index.html to /testing/index.html, then if this document contains links to /testing/img/logo.png, then the next request will contain /testing, and then the irule will append /testing --> wrong...
when rewriting path, you must look at response to be sure it does not contain the internal path in links.
so, if the customer accept redirect, it will be better.
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
