Forum Discussion

Gajji's avatar
Gajji
Icon for Cirrostratus rankCirrostratus
Apr 16, 2021

X-Forwarded-Host Configuration help

The X-Forwarded-Host HTTP request header is required to forward the original Host HTTP request header value to the origin server.

 

When the user sends requests to https://abc.pfc.net/ , the request forwarded by F5 to the backend server

 must contain the X-Forwarded-Host header with the value of the source of the request (which is https://abc.pfc.net/ in this example)

 

The backend server should be able to know what the host/FQDN from which the request came from so it will return to the client the same URL.

  • BIGIP doesn't modify HOST header values by default. So server should receive original HOST header coming from the client. But if you still want to pass it explicitly you can use something sort of below.

    when HTTP_REQUEST {
      while {[HTTP::header exists "X-Forwarded-Host"]}{
        HTTP::header remove "X-Forwarded-Host"
      }
      HTTP::header insert "X-Forwarded-Host" [HTTP::host]
    }