Forum Discussion
Chad_Emerson_85
Nimbostratus
May 18, 2006Easy redirect?
How would you guys recommend doing the follwoing?
A user hits a url https://www.bcbsal.com/webapps/providerfinder/jsp/find.jsp
I need it to change to https://www.bcbsal.org/webapps/providerfinder/jsp/find.jsp
I already have a rule that auto redirects the user if the request is http. It is below.
when HTTP_REQUEST {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
Am I going to have to do some string manipulation to find and replace the .com with .org?
Like this but I have something wrong...
when HTTP_REQUEST {
if { [HTTP::host] contains "bcbsal.com"} {
HTTP::redirect https://www.bcbsal.org/[HTTP::uri]
} else {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
}
Thanks!
4 Replies
- Deb_Allen_18Historic F5 AccountYou're probably getting a redirect to:
https://www.bcbsal.org//webapps/providerfinder/jsp/find.jsp
Try removing the "/" trailing the hostname, as it's already included in the URI:when HTTP_REQUEST { if { [HTTP::host] contains "bcbsal.com"} { HTTP::redirect https://www.bcbsal.org[HTTP::uri] } else { HTTP::redirect https://[HTTP::host][HTTP::uri] } } - Chad_Emerson_85
Nimbostratus
Cool that worked... sorta. One question. How can I make it change the follwoing https://bigtest.bcbsal.com/doctor/index.cfm to https://bigtest.bcbsal.org/doctor/index.cfm
There isnt a way that I have been able to find.... Is it because we cant read the query string in an https response? I really need this to work because my cert is expiring for the .com side and we redirect traffic to .org anyway so this would be great. Thanks for all the help! - Chad_Emerson_85
Nimbostratus
One more thing. I am terminating ssl on my LTM. - Deb_Allen_18Historic F5 AccountWell, if you want to send a redirect in response to an HTTPS connection, you still have to complete the handshake to send the redirect, so even if you are terminating SSL on the BIG-IP, that won't really relieve you of the problem of the expiring .com cert.
But to redirect any request for a bcbsal.com host to the same hostname.subdomain @ bcbsal.org, you could use a rule like this:
(You would NOT want to include the second condition if you are going to apply this rule to an HTTPS virtual, or any request with a host header NOT containing bcbsal.com will be caught in an endless redirect loop.)when HTTP_REQUEST { if { [HTTP::host] contains "bcbsal.com"} { HTTP::redirect https://[getfield [HTTP::host] ".bcbsal.com" 1].bcbsal.org[HTTP::uri] } }[
HTH
/deb
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
