RK

rajan

Founder & Programmer at HackersFriend July 18, 2021, 12:59 p.m. ⋅ 48 views

What is HTTP header X-Forwarded-Host ?


The HTTP X-Forwarded-Host header is the part of HTTP header that contains information for identifying the original host requested by the client. It is  de-facto standard header.

Real life usage

Suppose you have multiple location dependent servers to serve your users, and a load balancer on front of it. In this case, host of load balancer might differ from the host address of servers. Also, host of servers may vary as per their location. Here, HTTP X-Forwarded-Host header can be used to identify which server does the user wants to use for his request. Normally, this is helpful in location dependent servers.

Syntax

X-Forwarded-Host: <host>

Here, host will be the host address of server.

Example

X-Forwarded-Host: www.hackersfriend.com

To check the X-Forwarded-Host of any page you visited, you can go to Inspect Element then Network and then check the request header for X-Forwarded-Host.



Go back to feed

HackersFriend Updates





View more


Events


Nov. 28, 2018, 5:30 p.m.

Python from zero to hero

place Delhi

View details


Aug. 13, 2018, 5:30 p.m.

Python from zero to hero

place Bangalore ( HackersFriend office BTM Layout)

View details