Forum Discussion

acgutierrez_123's avatar
acgutierrez_123
Icon for Nimbostratus rankNimbostratus
Aug 22, 2013

HTTP to HTTPS Redirection

I have 2 Virtual Servers, one for port 80 and the other for port 443. In VS:80 there's an irule configured: when HTTP_REQUEST { if { [HTTP::uri] contains "/inscripcion-web/"} { pool pool_.93y.94_8690_inscripcion-web

 

I want that the service "inscripcion-web" to be attendeb by HTTPS.

 

I created a new pool for the service, created a new irule in it: when HTTP_REQUEST { if { [HTTP::uri] contains "/inscripcion-web/"} { pool pool_.93y.94_8691_inscripcion-web

 

When associating a http profile to the VS, it stops responding from internet.

 

My solution is: Create a new VS with a different secure port, associate a http profile and apply this irule: when HTTP_REQUEST { if { [HTTP::uri] contains "/inscripcion-web/"} { HTTP::redirect "https://www.icfesinteractivo.gov.co:XXX/inscripcion-web/”

 

This would redirect everything that contains the uri specified to HTTPS right? I'm not sure if that is going to make the request go to the nodes in the 443 VS.

 

any advice?

 

3 Replies

  • This rule (slightly modified):

    HTTP_REQUEST { 
        if { [string tolower [HTTP::uri]] contains "/inscripcion-web/" } { 
            HTTP::redirect "https://www.icfesinteractivo.gov.co:XXX/inscripcion-web/”
        }
    }
    

    Will catch any request with "/inscripcion-web/" in the URI and explicitly redirect the user to another URL - presumably another SSL VIP.

    If you wanted the server hosting the "/inscripcion-web/" information to be SSL, while the rest of the site is not, you can:

    1. Create a pool for this server - servers listening on 443 or other encrypted port
    2. Apply a server SSL profile to the VIP
    3. Apply HTTP and OneConnect profiles to the VIP
    4. Add an iRule like this:

      when HTTP_REQUEST {
          if { [string tolower [HTTP::uri]] contains "/inscripcion-web/" } {
              pool pool_.93y.94_8691_inscripcion-web
          } else {
              SSL::disable serverside
              pool pool_.93y.94_8690_inscripcion-web
          }
      }
      
  • HI Acgutierrez,

     

    Have you considered using the switch statement. It's more efficient then IF-ELSEIF-ELSE statements

     

    =Bhattman=

     

  • Take a look at the following WIKI about it

     

    https://devcentral.f5.com/wiki/irules.switch.ashx

     

    -=Bhattman=-