Forum Discussion

Eddie_27920's avatar
Eddie_27920
Icon for Nimbostratus rankNimbostratus
Feb 03, 2015

iRule help please, newbie

Hi I have the existing iRule that works just fine with checking the host name. On the last elseif when looking for abc.gov host name I also want to look for https protocol to send it to a seperate pool using 443. Basically the logic would be if host contains host1.gov AND is port 443 then use pool abc_443 ELSE use abc.gov (which is a port redirect to 58080). Is this possible? I can't fiond the commands to do the AND situation. Thanks, Eddie

 

6 Replies

  • shaggy's avatar
    shaggy
    Icon for Nimbostratus rankNimbostratus
    what port(s) does the associated virtual server(s) use?
  • How about this?

    if { ([string tolower [HTTP::host]] equals "swfm2.dev.mesaaz.gov") && ([TCP::local_port] == 443) } {
       pool swfm2_443
    } else {
       HTTP::redirect http://swfm2.mesaaz.gov:58080/
    } 
    
  • shaggy's avatar
    shaggy
    Icon for Nimbostratus rankNimbostratus
    i ask because if the F5 virtual server is listening on port 80 (non-ssl), then you will either need to use a second virtual server to handle the SSL traffic, or the irule will also need to select a server-ssl profile when sending traffic to a pool of ssl servers/services
  • There were wrong parentheses:

    when HTTP_REQUEST { 
        set host [string tolower [HTTP::host]] 
        if { $host eq "solidwaste.dev.mesaaz.gov"} { 
            pool solidwaste.dev.mesaaz.gov 
        } elseif { $host contains "swfm1.dev.mesaaz.gov"} { 
            pool swfm1.mesaaz.gov 
        } elseif { ($host contains "swfm2.dev.mesaaz.gov") && ([TCP::local_port] == 443) } { 
            pool swfm2.mesaaz.gov_443 
        } else { 
            pool swfm2.mesaaz.gov 
        } 
    }