Forum Discussion

tobin_dax_93013's avatar
tobin_dax_93013
Icon for Nimbostratus rankNimbostratus
Aug 31, 2009

redirection to http or https based on uri

Hi all

 

 

i must apologise in advance for asking this, as I am new to f5's and I am not even sure this is possible,but i'll ask anyway

 

 

I have a virtual server listing on port 80 and if the uri begins with a specific string "/xxxxx" i need it to need to pass the traffic to a pool listening on port 80 and for everthing else send it to a different pool accepting traffic on port 443 (these pools contain the same nodes listening on different ports.)

 

 

is it possible to create an irule to accomplish this task ?

 

 

someone knows of another way to accomplish this task that would be appricated to.

 

 

regards

 

Tobin
  • This should be very easy, although it's not 100% clear what the requirements are. I assume from the post that:

    1) You want traffic destined for URI /xxxxx to stay plaintext HTTP

    2) Anything else you want to send to an SSL-enabled virtual server

    If this is correct, setup a client SSL virtual server, then use something like this on your port 80 virtual server - the idea is that if it matches '/xxxx' send it through to the pool. Otherwise, redirect over to HTTPS. This isn't tested, but should serve as an example.

     
      when HTTP_REQUEST { 
      
     if { [HTTP::uri] starts_with "/xxxx" } { 
      
     pool plaintext-pool 
     } else { 
     HTTP::redirect https://[HTTP::host][HTTP::uri] 
     } 
      
     } 
     

    HTH,

    -Matt
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    A very similar request was made in another thread. The solution there is a good one and worth checking out:

     

     

    Click here

     

     

    Colin