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 tra...
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
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