Forum Discussion
Sorin_Rusnac_86
Nimbostratus
18 years agohttp redirect ?
Hi -
I am trying to do a redirect as such:
when HTTP_REQUEST {
HTTP::redirect "http://[HTTP::host]/mysite/test1"
}
I dont get any errors but when I apply the irule it does not seem to work. If I do this:
when HTTP_REQUEST {
HTTP::redirect "http://[HTTP::host][HTTP::uri]"
}
it does work however I want the F5 to always send it to HTTP::host /mysite/test1 so the /mysite/test1 will never change.
Thanks
1 Reply
- Nicolas_Menant
Employee
Hi,
when HTTP_REQUEST {
HTTP::redirect "http://[HTTP::host]/mysite/test1"
}
Here you create an infinite loop since it will be triggered on every HTTP request.
you should try something like this:when HTTP_REQUEST { if { not ([HTTP::uri] contains "mysite") } { HTTP::redirect "http://[HTTP::host]/mysite/test1" } }
This way if the uri contains mysite, it means the client has already been redirected and shouldn't be redirected anymore
HTH
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
