Forum Discussion
Redirect from https://cardiosmart.org to https:www.cardiosmart.org
Hello,
We have an SSL cert for https://www.cardiosmart.org (does not include https://cardiosmart.org). So, users get an alert when typing the latter in their browser. We have two VS objects on our F5 (http and https) The http VS object (and irule) redirects the port 80 traffic to the https (443) VS object (and two irules).
I'm wanting to know if (and how) I can modify any of my existing iRules for either of these objects to redirect users who type https://cardiosmart.org into their browser automatically to https://www.cardiosmart.org. This would be simpler than having to re-mint our cert.
Below are the existing iRules:
HTTP_VS - Just one iRule:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "/Videos.aspx" } { if {[active_members Cardiosmart_HTTP] > 0} { pool Cardiosmart_HTTP } else {HTTP::redirect "http://maintenance.acc.org" event disable all } } else { HTTP::respond 301 Location https://www.cardiosmart.org[HTTP::uri] } }
HTTPS_VS - Two iRules
when HTTP_REQUEST { if { [string tolower [HTTP::host]] contains "healthandwellness.cardiosmart.org" } { HTTP::redirect "https://www.cardiosmart.org[HTTP::uri]" } if { [string tolower [HTTP::host]] equals "http://cardiosmart.org" } { HTTP::redirect "https://www.cardiosmart.org" } }
This second rule redirects to a maintenance page.
when HTTP_REQUEST { if {[active_members Cardiosmart_HTTPS] > 0} { pool Cardiosmart_HTTPS
} else { HTTP::redirect "http://maintenance.acc.org" event disable all } }
Thanks in advance for your assistance.
Diane
2 Replies
- nitass
Employee
you can modify the https virtual server irule but it won't fix certificate warning page since HTTP_REQUEST is triggered after ssl handshake.
also, you may set event priority to make sure irules are executed in correct order.
The101: iRules 101 - Events & Priorities by Colin Walker
https://devcentral.f5.com/articles/-the101-irules-101-events-amp-priorities.U1k_JFdhfIUwhen HTTP_REQUEST priority 600 { switch [string tolower [HTTP::host]] { "healthandwellness.cardiosmart.org" - "cardiosmart.org" { HTTP::redirect "https://www.cardiosmart.org[HTTP::uri]" } } } - dlogsdonmd
Nimbostratus
Thank you for your help Nitass. Will look at the priorities and modify our cert.
Diane
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