Forum Discussion
scampbell_82082
Nimbostratus
Mar 10, 2008Rewriting 3xx responses from http to https only for on-site URLs
I started out by using the "Redirect Rewrite All" option in my HTTP profile. However, the Location header in the 3xx HTTP responses was being rewritten from HTTP to HTTPS whether the hostname was on-site or off-site.
I need a "Redirect Rewrite", but only when a particular hostname is present. I talked to F5 support and they said that I needed to build an iRule.
Here is my setup:
client -HTTPS-> myapp.example.com -> BigIP -HTTP-> web server pool
When the HTTP response code is 3xx and the Location header has the hostname myapp.example.com, I want the Location header to be rewritten from HTTP to HTTPS.
If the Location header for the 3xx response is some other hostname, such as www.cnn.com, then I want the iRule to leave it alone.
1 Reply
- Nicolas_Menant
Employee
Hi,
You need to set up a vs with:
-a clientSSL profile
-a pool with pool member listening on HTTP (port 80?)
Here is some template you should check to set up your iRule:
when HTTP_RESPONSE {
if {([HTTP::status] starts_with "3") and ([HTTP::header "Location"] equals "myapp.example.com") }{
HTTP::header replace "Location" "https://myapp.example.com"
}
}
Some links you should have a look at:
HTTP::header manipulationClick here
Click here
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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