Forum Discussion
Https redirect
I'm trying to redirect https://test.com to https://test.com/testing. Here is what I have so far
when HTTP_REQUEST { if { [HTTP::host] equals "test.com" } { HTTP::redirect "https://test.com/testing" } }
I get redirected to https://test.com/testing but I'm getting an error "This webpage has a redirect loop" Thanks in advance.
You need to examine [HTTP::uri] as well. So that your if clause does not trigger for every request, but instead only for where uri is set to /.
Something like this
when HTTP_REQUEST { if { [HTTP::host] equals "test.com" && [HTTP::uri] equals "/" } { HTTP::redirect "https://test.com/testing" } }
/Andreas
- AndOsCirrostratus
You need to examine [HTTP::uri] as well. So that your if clause does not trigger for every request, but instead only for where uri is set to /.
Something like this
when HTTP_REQUEST { if { [HTTP::host] equals "test.com" && [HTTP::uri] equals "/" } { HTTP::redirect "https://test.com/testing" } }
/Andreas
- ema_128890Nimbostratus
Thank you that worked
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