Forum Discussion

Roman_80473's avatar
Roman_80473
Icon for Nimbostratus rankNimbostratus
Jul 01, 2011

How to find HOST protocol inside iRule?

Hi folks,

 

 

Is there a way to find host protocol inside HTTP_REQUEST event in iRule? I can get host ([HTTP::host] ) and uri ([HTTP::uri]), but not sure about protocol.

 

 

 

Any help is appreciated,

 

Thanks, Roman

4 Replies

  • Hi Roman,

     

     

    You can't tell from just the HTTP headers or payload whether the request was sent via SSL. You can either assume SSL based on the virtual server port [TCP::local_port] or use an iRule to test whether a cipher was used:

     

     

    http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=1170929&ptarget=1170978

     

     

    Aaron
  • Aaron,

     

     

    Thank you for your reply. Should I use both approaches to determine for sure whether SSL is used?

     

    if TCP::local_port value is 443 AND if {not ([catch {SSL::cipher version} result]) && $result ne "none"}

     

    protocol = "https"

     

     

     

    Thanks, Roman

     

  • Hi Roman,

     

     

    You don't need to check the port if you use this:

     

     

    if {not ([catch {SSL::cipher version} result]) && $result ne "none"}

     

     

    Aaron