Forum Discussion

John_45559's avatar
John_45559
Icon for Nimbostratus rankNimbostratus
Jun 16, 2010

I will try here.. Modification http header

I need an IRule for an HTTP request.

 

 

I need to modify the HOST: xxx.xxx.xxx.xxx field in the header.

 

 

Example:

 

 

POST /webservice/services/ProvisioningService HTTP/1.1

 

Accept-Encoding: gzip,deflate

 

Content-Type: text/xml;charset=UTF-8

 

SOAPAction: ""

 

User-Agent: Jakarta Commons-HttpClient/3.1

 

Host: X.X.X.X <----------- I want to replace this ip with a member IP in the pool (which is the active member.

 

Content-Length: 780

 

 

 

 

I would like to change the HOST: field from the IP (which is the vitrual server IP) to the IP of active member in the pool (there are 2 members). This rule would be on a HTTP_REQUEST rule. I can't access the wiki as it crashes my browser

 

 

I have tried posting in other topics but since I am a newb adding the situation apparently causing confusion of what I want since the response from the endpoint is a redirect and I don't want a redirect.

 

 

 

Thanks

 

 

John

 

 

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi John,

    If you want to rewrite the HTTP host header value to the IP address of the selected server, you can use an iRule like this:

    
    when HTTP_REQUEST_SEND {
    
        Force evaluation in the clientside context
       clientside {
    
           Replace the Host header value with the selected server IP address
          HTTP::header replace Host [LB::server addr]
       }
    }
    

    Aaron