Forum Discussion
Ashley_Penney_5
Nimbostratus
Sep 26, 2008HTTP to HTTPS redirect when 401 received.
Hi,
We have a very... awkward.. web environment here at work, and I'm hoping that I can get some help here to achieve something. We currently do all the SSL handling on the BigIP, and ...
hoolio
Cirrostratus
Sep 26, 2008It's a good suggestion to explicitly save the values of HTTP::host and HTTP::uri from the request as they aren't saved by default through to the HTTP_RESPONSE event.
The syntax is slightly off though:
when HTTP_REQUEST {
set host [HTTP::host]
set uri [HTTP::uri]
}
when HTTP_RESPONSE {
if {[HTTP::status] == 401]}{
HTTP::redirect "https://$host/$uri"
}
}
I assume you have an HTTP VIP and an HTTPS VIP and that you're applying this rule to only the HTTP VIP? If you don't have a test BIG-IP, you can create test VIPs on the production BIG-IP to check the iRule.
Aaron
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