Application Delivery (ADX)

How do I rewrite the HTTP host header

by on ‎05-28-2009 12:09 AM (188 Views)


Rewriting the existing host header of the HTTP request when the HTTP request passes the ServerIron


Some web server/applications require the host header to be rewritten/altered for application compatibility on real server(s). Clients connect to the virtual server in front of the real servers using the FQDN of the virtual server as host header. A virtual server with the IP address a.b.c.d might be known as and incoming HTTP requests would have the following host header:


The example below covers the following case:

The load balancer/ServerIron might do a port mapping on the way to the real servers. Incoming requests do use port 80 but the real server do listen at port 81. The real servers need to see their own port in the host header in some cases to prevent application problems. The header

Host: needs to get changed to


Sample Script/Code/Configuration

csw-rule "" header "host" equals "WWW.WHATEVER.COM" case-insensitive

csw-policy "pol" case-insensitive

  match "" forward 1

  match "" rewrite request-insert ":81"

server real rs101

  port 81

  port 81 group-id 1 1

server virtual vs222

  port http

  port http csw-policy "pol"

  port http csw

  bind http rs101 81

Tips / Caveats

Further Reading