Forum Discussion
IRULE WHICH EXTENDS AN HTTPS HEADER TO ANOTHER HTTPS HEADER (AVOIDING INFINITE REDIRECTION LOOPS))
Hello, I have been requested to create an irule which redirects in the following format. https://kazeem.networkershome.com to https://kazeem.networkershome.com/ux/kazeemapp.
I implemented an irule on the Virtual HTTPS header but was getting an infinite redirection loop.
when HTTP_REQUEST {
if { [HTTP::host] equals "kazeem.networkershome.com" } {
HTTP::redirect "
} else {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}2 Replies
- Stanislas_Piro2
Cumulonimbus
try this:
when HTTP_REQUEST { if { [HTTP::host] equals "kazeem.networkershome.com" && [HTTP::uri] equals "/"} { HTTP::redirect "https://kazeem.networkershome.com/ux/smart-it"; } } - IheartF5_45022
Nacreous
Just an FYI - the code above will perform an 302 (Conditional) redirect. A 301 (permanent) redirect is more appropriate in this situation, and will increase SEO rankings.
HTTP::respond 301 noserver Location "https://kazeem.networkershome.com/ux/smart-it"If you don't want browsers to cache it you can add a Cache-Control directive;
HTTP::respond 301 noserver Location "https://kazeem.networkershome.com/ux/smart-it" Cache-Control "max-age=7200"
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