Forum Discussion
Tyler_Jason_985
Nimbostratus
Aug 02, 2006Redirect HTTP to HTTPS Based upon URL
Hello all,
I am new to iRules, BigIP and the like so I apologize in advance.
I have a situation where I need to redirect HTTPs to HTTP when a url does not start with 'abc.xyz.com'.
Background: In order for our application to work, we must set the BigIP's rewrite parameter to 'ALL'. By doing so, all urls redirect to https. This is due to a known defect between IBM's WebSphere App Server - webserver plugin and BigIP (IBM Reference 1116533 - Compatibility problems with hardware secure socket layers accelerators and the WebSphere Application Server Web server plugin).
However, there are some URLs in our application that should not be redirected to HTTPS. If there wasn't a conflict between IBM WAS and BigIP, we could set the rewrite parameter to 'Matching' and our problem would be resolved.
So, since we have to set the rewrite to 'All', will an iRule do the trick to resolve my issue? Will the iRules fire after the rewrite parameter fires?
Based upon the forums and the reference material, I put together an iRule. Am I on the right track?
when HTTP_REQUEST {
if the uri does not contain "abc.xyz.com", then redirect
to the HTTP version
if { ! [matchclass [HTTP::uri] contains "abc.xyz.com"] }
{ HTTP::redirect "http://[HTTP::host][HTTP::uri]" }}
Thank you in advance!
- The matchclass command is used to lookup values in a data group. This isn't needed since you are using a single string comparison on HTTP::host.
when HTTP_REQUEST { if { ! [HTTP::host] equals "abc.xyz.com" } { HTTP::redirect http://[HTTP::host][HTTP::uri] } }
- Tyler_Jason_985
Nimbostratus
Thanks Joe for your quick response. I really appreciate it! - Jim_Reilly_4704Historic F5 AccountJoe this is similar to the request above as it has to do with the rewrite all function modifying redirects to sites not hosted by the origin application.. Rewriting a 30x based on the host name in the location field. For example if the location contains abc.com then rewrite to HTTPS://host/uri. iRule 1st timer appreciate the patience. Thanks in advance.
- Jim_Reilly_4704Historic F5 AccountThanks I will try this.
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