Forum Discussion
darrenfoo_19996
Nimbostratus
Jun 15, 2011Rewrite http to https for HTTP::host only
Hi all, I'm working on getting SSL offload working with our F5 LTM's but need some tweaks to iRules we have. The application in question was never designed with SSL offloading in mind and th...
hoolio
Cirrostratus
Jun 15, 2011Hi,
I think something like this should work:
when HTTP_REQUEST {
Save the requested host value
set host [string tolower [HTTP::host]]
Disable the stream filter by default
STREAM::disable
}
when HTTP_RESPONSE {
Check if response type is text and host isn't null
if {[HTTP::header value Content-Type] contains "text" and $host ne ""}{
Replace http://$host with https://$host
STREAM::expression "@http://$host@https://$host@"
Enable the stream filter for this response only
STREAM::enable
if { [HTTP::is_redirect] } {
HTTP::respond 302 Location [string map "http://$host https://$host" [HTTP::header Location]]
}
}
Aaron
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