Forum Discussion
REDIRECTION ISSUE
when HTTP_REQUEST {
set userhost [HTTP::host]
if { $userhost == "testdomain.org"} {
set userhost "www.[HTTP::host]"
}
HTTP::redirect https://$userhost[HTTP::uri] }
It works GREAT. My issue now is I need to be able to add subdomain.testdomain.org, testdomain.net, etc. Creating a 2nd rule doesn't help. I tried combining them and separating them with an 'or' but got errors. I tried downloading the iRule editor but the download link seems to just loop back to where you start. I need this rule because the SSL cert on the F5 is only for www.testdomain.com and the rule prevents the cert error that makes end-user think there's some issue. Please help, I'm an iRule idiot.
Jhd
- JonasD_46068
Nimbostratus
I tried to use an elseif to add the subdomain.testdomain.com and it is appending www.subdomain.testdomain.com which does NOT exist. So I am close but no cigar. I see 'why' it did it but I"m not sure how to fix. Here's what I tried that didn't quite work: - Colin_Walker_12Historic F5 AccountI think what you're looking for is something like:
when HTTP_REQUEST { set userhost [HTTP::host] if { $userhost equals "testdomain.org"} { set userhost "www.[HTTP::host]" } elseif { $userhost equals "ml.testdomain.org"} { set userhost "[HTTP::host]" } elseif { $userhost equals "testdomain.net"} { set userhost "www.[HTTP::host]" } HTTP::redirect "https://$userhost[HTTP::uri]" }
- Parveez_70209
Nimbostratus
Hi Colin,
Here is the detailed issue:
We have HTTP plus HTTPS Virtual-Server, where anyone who will hit:: http://shop.test.com/broutlet or http://shop.test.com/broutlet/* , it should redirect to http://outlet.lenovo.com/broutlet/br/pt/ to be accurate.
Where /* can be anything, for now only http://shop.test.com/broutlet/ redirection is happening to http://outlet.lenovo.com/broutlet/br/pt/ but not with http://shop.test.com/broutlet/*(just one for example : http://shop.test.com/broutlet/br/pt)
Regards PZ
- Parveez_70209
Nimbostratus
Hi Team,
The below Irule is working good, sorry for the confusion:
when HTTP_REQUEST {
But this is giving 302 redirection, it should give 301 redirection, how my Irule will look like.
Thanks and Regards Parveez
- nitass
Employee
But this is giving 302 redirection, it should give 301 redirection, how my Irule will look like.
you have to use HTTP::respond instead of HTTP::redirect.
HTTP::respond
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