Forum Discussion

Arley_6164's avatar
Arley_6164
Icon for Nimbostratus rankNimbostratus
Jun 29, 2009

One Virtual Server on All Ports

I was trying to consolidade some of our big-ip deployments and came with an ideia for some websites to aggregate them on one single Virtual Server. For that matter I'd set up a VS listening on *all ports* and build my irule as follow:

 
 if {[TCP::local_port] equals 80} { 
 switch -glob [string tolower [HTTP::host]] { 
 "foo.com"{ pool foo } 
 default {  
 discard 
 } 
 } 
 } 
 elseif {[TCP::local_port] equals 443} { 
 switch -glob [string tolower [HTTP::host]] { 
 "secure.foo.com"{ pool foo_secure } 
 default {  
 discard 
 } 
 } 
 } 
 else { 
 [HTTP::redirect "http://www.microsoft.com"] 
 } 
 

Basically debugs shows nothing, it seems that the Virtual Server doesnt even comes up when *All Ports* option enabled, no traffic reaches the irule.

Any ideas?

Cheers,

Arley

4 Replies

  • If you want to selectively decrypt SSL for some requests, you would need to add a client SSL profile to the virtual server and then disable it for requests which don't use SSL.

     

     

    Also, you should take off the square braces around HTTP::redirect, as that would try to execute the return value of the redirect.

     

     

    Here is an example for handling multiple ports/protocols on the same virtual server:

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/HttpHttpsSingleVirtualServer.html

     

     

    Lastly, if you have any specific port virtual servers defined (like port 80 or 443), they would take precedence over the port 0 virtual server. So you would need to delete those before testing this iRule on a port 0 virtual server.

     

     

    Aaron
  • Posted By cmbhatt on 06/29/2009 11:07 AM

     

    What is the EVENT are you using?

     

    CB

     

     

     

    when HTTP_REQUEST