Forum Discussion

brad_scherer_11's avatar
brad_scherer_11
Icon for Nimbostratus rankNimbostratus
May 05, 2006

another challanging rediret

We terminate SSL on the F5 for this site. The backend is http over 7678 to the servers.

 

 

when HTTP_REQUEST {

 

if { [HTTP::host] equals "mywebsite.mydomain.com" }{

 

HTTP::redirect "https://mywebsite.mydomain.com/index.html

 

} elseif { [HTTP::uri] equals "/help" }

 

HTTP::redirect "https://mywebsite.mydomain.com/help/index.html"

 

} else {

 

pool WEB_POOL

 

}

 

 

What we want to do is add index.html to all https requests.

 

Does it look like this rule would work for that.
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    It looks like you're pretty close. You might want to do a couple things different.

    First, I'd recommend using the HTTP::uri command, rather than doing full on HTTP::redirects, as they shouldn't be necessary.

    Second, rather than checking for certain directories, if you truly want to append "index.html" to all requests coming through this virtual, it's done with relative ease like this:

    
    when HTTP_REQUEST {
      if { not ( [HTTP::uri] ends_with "/" ) } {
        set newURI "[HTTP::uri]/index.html"
      } else {
        set newURI "[HTTP::uri]index.html"
      }
      HTTP::uri $newURI
    }

    This should modify the URI to append index.html to whatever was currently there.

    HTH,

    Colin
  • Thanks Colin.

     

     

    I listed my reqs incorrectly.

     

    W

     

    hen a customer goes to the site https://mywebsite.mydomain.com they should be redirected to https://mywebsite.mydomain.com/index.html.

     

     

    Once logged into the site if they click "help" they should get redirected to https://mywebsite.mydomain.com/help/index.html.

     

     

    Currently with no Rule in place when they click "help" it tries to send them back to http instead of keeping them https and it does not append the /index.html. Currently there is no 80 to 443 redirect because an https link/shortcut is copied and saved on everyones desktop via login script, but as you can guess this cause frustration for users that do not log into our domain often or ever. In the future we may add the http2https functionality and if I can come up with a good working rule for this now that covers all of the above reqs then I can probably push to get it implemented all at once.

     

     

    Thank you for your help

     

     

    brad
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    If you can't fix your app to send https or relative links, you can use the stream profile to do a content replacement for all proxied links.

     

     

    If you replace "http://host.domain.com/" with "https://host.domain.com/", all the links presented to the browser for that host will now be https.

     

     

    You probably also want to turn on "Redirect Rewrites", set to "Matching", to rewrite any redirects the webservers sends to https. (Redirect info is in the headers, not the content, so they are not re-written by the stream profile above.)

     

     

    With these 2 features enabled, the port 80 redirect rule should only get hit once per session.

     

     

    /deb