Forum Discussion
Joe_Pipitone
Aug 11, 2015Nimbostratus
Mobile browsers broken - https redirect
BigIP 1600's - v11.6 HF 4
I have a simple iRule that forces https and strips the www. We have a CMS running that automatically detects the user agent, and redirects the mobile browser to the mobil...
Aug 13, 2015
Most likely your issue is the "TCP::local_port". Check out the docs for an example with all the values:
https://devcentral.f5.com/wiki/iRules.TCP__local_port.ashx
You'll likely want to use [TCP::Local_port clientside] if you are looking for the front end VIPs port. Omitting the "clientside" is the same as using "serverside".
This potentially should work (haven't tested it thought)
when HTTP_REQUEST {
if {([string tolower [HTTP::host]] starts_with "www.")} {
HTTP::redirect "https://[string range [HTTP::host] 4 end][HTTP::uri]"
return
} elseif { [TCP::local_port clientside] == 80 } {
HTTP::redirect https://[HTTP::host][HTTP::uri]
return
}
}
Beyond that, I'd recommend adding in some log statements and making sure the values you are expecting to match on are working as you expect.
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