Forum Discussion
I want to Redirect multiple Sites in a single Irule. please help me with the irule command.
I have mulitple sites where i want my LAN users should not to redirected to https when they use url with http. but when any internet users use http://abc.com than it should redirect to https://abc.com
Can i use the below irule for this.
when HTTP_REQUEST { if {[HTTP::host] equals "abc.com"} { HTTP::redirect "https://abc.com[HTTP::uri]" } }
Now i want to do for multiple sites in same irule can i use another if statement?
49 Replies
This irule will work. You may change it to fit for your need of multiple sites :
when HTTP_REQUEST { switch -glob [HTTP::host] { "hostname1" { HTTP::redirect "https://hostname1[HTTP::uri] } "hostname1" { HTTP::redirect "https://hostname1[HTTP::uri] } "hostname2" { HTTP::redirect "https://hostname2[HTTP::uri] } default { } } }If this is just for redirecting http to https, you can just use this irule :
when HTTP_REQUEST { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
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