Forum Discussion

santosh_81454's avatar
santosh_81454
Icon for Nimbostratus rankNimbostratus
Apr 13, 2010

Clarification on HTTP::host

Does HTTP::host understand only the text part of the host or can it resolve its IP address and then check the conditions

 

 

For Example:

 

 

If I have the nslookup for domain.com as 20.30.40.1

 

and the Irule in place is as below:

 

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::host][HTTP::uri]] {

 

"*domain.com/images/*" { pool DefaultPool}

 

default {drop }

 

}

 

}

 

 

will the HTTP::host search for "domain.com" or 20.30.40.1 in the condition part??

 

 

 

 

1 Reply

  • Hi Santosh,

     

     

    HTTP::host returns whatever the client sends in the HTTP host header. If a user accesses http://20.30.40.1/index.htm, then the browser sets the host header to 20.30.40.1. Likewise, if a user accesses http://www.example.com:80/index.htm, then the browser sets the host header to www.example.com:80.

     

     

    Your iRule should work to select the default pool as long as the client uses a domain name in the host header.

     

     

    Aaron