Forum Discussion
kraigk_52257
Nimbostratus
Jul 01, 2015Inefficient iRule, works but not perfect
We have a working iRule that I'm sure can be improved/. The first section is simple redirects from domain.org URL to equivalent https domain.com URL. We discovered that if users browsed directly to...
nathe
Cirrocumulus
Jul 01, 2015is this neater and more efficient? let me know if it doesn't meet all your requirements. Away from the lab at the moment to test.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"team.domain.org" { HTTP::respond 301 Location "https://team.domain.com[HTTP::uri]" }
"site1.domain.org" { HTTP::respond 301 Location "https://site1.domain.com[HTTP::uri]" }
"site2.domain.org" { HTTP::respond 301 Location "https://site2.domain.com[HTTP::uri]" }
"myteam.domain.org" { HTTP::respond 301 Location "https://myteam.domain.com[HTTP::uri]" }
"*.domain.com" { HTTP::respond 301 Location "https://[HTTP::host]/default.aspx" }
}
}
Obviously a 301 is permanent redirect, i've assumed this.
N
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