Forum Discussion
Gerardo_Garcia_
Jul 24, 2008Nimbostratus
This is the iRule that I have, I just changed the name of the url to the one for the company.
This is the version BIG-IP 9.2.4 Build 13.1
when HTTP_RESPONSE {
if { not ([matchclass [IP::client_addr] equals $::internal_net])}{
Enable debug logging to /var/log/ltm? 1=yes, 0=no
set debug 1
STREAM::disable
If the response content type is text, configure the default stream profile to replace http:// with https://
if {[string tolower [HTTP::header value Content-Type]] contains "text"}{
STREAM::expression {@http://.*?example\.com@@}
STREAM::enable
}
Check if the response is a redirect (3xx)
if {[HTTP::is_redirect]}{
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]]
}
}
}
when STREAM_MATCHED {
log local0. "[IP::client_addr]:[TCP::local_port]: matched: [STREAM::match], replaced with: [string map {http:// https://} [STREAM::match]]"
STREAM::replace "[string map {http:// https://} [STREAM::match]]"
}