Forum Discussion

Chad_Emerson_85's avatar
Chad_Emerson_85
Icon for Nimbostratus rankNimbostratus
May 18, 2006

Easy 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!
  • 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!
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Well, 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:
    when HTTP_REQUEST {
    if { [HTTP::host] contains "bcbsal.com"} {
    HTTP::redirect https://[getfield [HTTP::host] ".bcbsal.com" 1].bcbsal.org[HTTP::uri]
    }
    }[
    (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.)

    HTH

    /deb