Rewrite Host Header to Server IP:port

Problem this snippet solves:

On each HTTP request, the iRule replaces the Host header value with the selected pool member IP address and port. Some web servers and web applications require this to serve requests.

Code :

# From: https://devcentral.f5.com/s/wiki/iRules.http_request_send.ashx
when HTTP_REQUEST_SEND {

   # Need to force the host header replacement and HTTP:: commands into the clientside context
   # as the HTTP_REQUEST_SEND event is in the serverside context
   clientside {

      # Replace the HTTP host header with the selected server IP and port
      HTTP::header replace Host "[LB::server addr]:[LB::server port]"
   }
}
Published Mar 18, 2015
Version 1.0
No CommentsBe the first to comment