Forum Discussion

tokenrock_79479's avatar
tokenrock_79479
Icon for Nimbostratus rankNimbostratus
Jul 19, 2011

http to https redirect with filename

We've recently migrated a server to only respond to https requests, but the site has many embedded file links that are http. The built in irule redirects the client, but it looses the url link to the file. An example is, the link is redirected to . There are hundreds of embedded links, so the urls will all be different.

 

 

Is there a way to redirect, and keep the entire url? Sorry if this is a basic question, but I'm not a scripting person.

2 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Well, you have two straight-forward options here. One would be to redirect the requests to the appropriate HTTPS link as they come in. The other is to re-write the content of the response the server is sending to convert them to HTTPS links before the client even sees them, so they would never request the non HTTPS links.

    The redirect that you asked for would look something like:

    
    when HTTP_REQUEST {
      if {([HTTP::host] eq "getintel.tn.get") && ([TCP::local_port] != 443) } {
        HTTP::redirect "https://[HTTP::host][HTTP::uri]"
      }
    }
    

    This will look for any request to your domain that isn't connecting via SSL and redirect it to the same host-name and URI, but via HTTPS. That's my understanding of what you were looking for, is that correct?

    If you're interested in the content re-writing option let me know and I can give you an example.

    Colin