Forum Discussion

Kirit_Patel_521's avatar
Kirit_Patel_521
Icon for Nimbostratus rankNimbostratus
Jun 01, 2010

https redirect

Does anyone know how to do redirect to https in f5 using irule . On ace I do it this way

 

 

 

rserver redirect turn-redirect

 

webhost-redirection https://%h%p

 

inservice

 

 

 

serverfarm redirect 218.7.139.10-redirect

 

description arch-notest.turn.com

 

predictor leastconns

 

rserver turn-redirect

 

inservice

 

 

3 Replies

  • This will do an HTTP to HTTPS Redirect on any Virtual Server it is applied to:

    
    when HTTP_REQUEST {
      HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
    }
    
  • The command is a way to strip out a port in the host header field, if one is present.

     

     

    getfield parses the HTTP host header value, splits it on a : if one is there and returns the first field. See the wiki page for details:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/getfield

     

     

    So if you have a host header of www.example.com:80 or www.example.com, that getfield command will return www.example.com in both cases.

     

     

    Aaron