Forum Discussion
iRule buttons not showing properly
The code works but not entirely as I had hoped. I noticed that on switch based websites the buttons on several components aren't showing properly. If it might help these are login(key button), search(looking glass) and contact page(3 stripes). I think the cause might be due the websites behind these buttons are in https but not sure if this is possible to fix.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host][HTTP::uri]] {
"www.abc.com/xyz/def*" -
"www.abc.com/xyz*" -
"www.abc1.com/xyz/def*" -
"www.abc2.com/xyz/def*" -
"www.abc3.com/xyz/def*" -
"www.abc4.com/xyz/def*" -
"www.abc5.com/xyz/def*" -
"www.abc6.com/xyz/def*" -
"www.abc7.com/xyz/def*" -
"www.abc8.com/xyz/def*" {
return
}
default {
HTTP::respond 302 location "https://[HTTP::host][HTTP::uri]"
}
}
}Thank you in advance!
1 Reply
- Michael_Jenkins
Cirrostratus
If the website is being served on HTTPS and those resources are being accessed by HTTP, then you're going to run into a mixed content issue where the browser won't allow you to load insecure content from a secure page. The best way to fix this is to use HTTP for all resources on the page. Once other option would be to use
instead of//
for references because it will pick up on the pages protocol itself. So for example, an image might look likehttp://
instead of
.If you can't change the website, then you may want to look at using an iRule and stream profile to rewrite http:// to https:// in your page(s).
You can also add some logging in your iRule to see if there's something else going on. (Check the developers console in your browser too in order to verify the mixed content error)
when HTTP_REQUEST { log local0. "HostUri: '[HTTP::host][HTTP::uri]'" switch -glob [string tolower [HTTP::host][HTTP::uri]] { "www.abc.com/xyz/def*" - "www.abc.com/xyz*" - "www.abc1.com/xyz/def*" - "www.abc2.com/xyz/def*" - "www.abc3.com/xyz/def*" - "www.abc4.com/xyz/def*" - "www.abc5.com/xyz/def*" - "www.abc6.com/xyz/def*" - "www.abc7.com/xyz/def*" - "www.abc8.com/xyz/def*" { log local0. " Found it! Returning" return } default { log local0. " Didn't find it. Redirecting" HTTP::respond 302 location "https://[HTTP::host][HTTP::uri]" } } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
