katekattar_4936
Jun 17, 2009Nimbostratus
Irule to prevent mixed content
Hi - We have what looks like a fairly simple issue, but it I can't crack it. We are trying to send all HTTP traffic to HTTPS with this irule:
On VIP-80
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/paymentoptionshome/payments" } {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
Then send all HTTPS traffic to HTTP using this irule:
On VIP-443
when HTTP_REQUEST {
if { (!( [HTTP::uri] starts_with "/paymentoptionshome/payments")) and ([TCP::local_port] == 443) } {
HTTP::redirect "http://[HTTP::host][HTTP::uri]"
}
}
Having this second irule in place forcing mixed content when accessing the uri /paymentoptionshome/payments. We can't have mixed content as the padlock doesn't show and the business is not keen to not show the padlock. Ideally we want the irule to look something like this:
class file_extensions {
".gif"
".htm"
".html"
".jpg"
".js"
".css"
".swf"
".jpeg"
".pdf"
}
when HTTP_REQUEST {
if { (!( [HTTP::uri] starts_with "/paymentoptionshome/payments") and [matchclass $uri ends_with $::file_extensions] > 0 ) and ([TCP::local_port] == 443) } {
HTTP::redirect "http://[HTTP::host][HTTP::uri]"
}
}
But this doesn't work. Can anyone help?
Thanks
Kate