Forum Discussion
zia_101571
Nimbostratus
Nov 02, 2007redirect HTTP to HTTPs
Hi
We have f5 load balancer 9.X. Our SSL certificate is loaded in F5. Communication between F5 and webservers are done through port 80. We want to know how to build a I-rule so it can trap response 302 http to redirect to HTTPS. I have open a case with f5 C385918,My support engineer Brant aske me post this request to your site
3 Replies
- hoolio
Cirrostratus
Hi there,
You should be able to rewrite HTTP to HTTPS with the rewrite redirects option on the HTTP profile associated with your VIP (Click hereπ
Redirect Rewrite
Specifies whether the system rewrites the URIs that are part of HTTP redirect (3XX) responses. The default setting is None.
* None: Specifies that the system does not rewrite the URI in any HTTP redirect responses.
* All: Specifies that the system rewrites the URI in all HTTP redirect responses.
* Matching: Specifies that the system rewrites the URI in any HTTP redirect responses that match the request URI.
* Nodes: Specifies that if the URI contains a node IP address instead of a host name, the system changes it to the virtual server address.
If you do want to use a rule, you can use something like this:when HTTP_RESPONSE { Enable debug logging to /var/log/ltm? 1=yes, 0=no set debug 1 Check if the response is a redirect (3xx) if {[HTTP::status] starts_with "3"}{ if {$debug}{ log local0. "Original Location: [HTTP::header value Location], Updated Location: [string map {http: https:} [HTTP::header value Location]]" } Use 'string map' to replace http: with https: HTTP::header replace Location [string map {http: https:} [HTTP::header value Location]] } }
Aaron - zia_101571
Nimbostratus
Thank you for the script. When we apply the script it failed because of following
Without bracket β way it came
if {[HTTP::status starts_with "3"}{
01070151:3: Rule [ThreeXXredirect] error:
line 7: [parse error: PARSE missingBracket 148 {missing close-bracket}] [{[HTTP::status starts_with "3"}] - hoolio
Cirrostratus
Sorry, I missed the close bracket on HTTP::status. That line should be:
if {[HTTP::status] starts_with "3"}{
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
