The HTTP headers are used to communicate between client and server. HTTP headers let the client and server pass additional information with an HTTP request or response. X-Forwarded-Proto (XPF) header is used to identifying the protocol that the client used to connect with a proxy or load balancer. It can be HTTP or HTTPS. Your server access log usually contains information about the protocol used between server and load balancer, but it does not contain any information about the protocol used between the client and load balancer. To get information about which protocol used between client and load balancer, we can use the X-Forwarded-Proto request header. Using this header, the client can make an HTTP request to an HTTPS-only resource.
Syntax:
X-Forwarded-Proto: <protocol>
Directives:
- <protocol>: This contains an X-Forwarded-Proto request header for a request that originated from the client(http or https).
Example 1: The following example contains an X-Forwarded-Proto request header for a request that originated from the client as an HTTP request:
HTML
// X-Forwarded-Proto: originatingprotocol
X-Forwarded-Proto: http
|
Example 2: The following example contains an X-Forwarded-Proto request header for a request that originated from the client as an HTTPS request:
HTML
// X-Forwarded-Proto: originatingprotocol
X-Forwarded-Proto: https
|
Example 3: This example is for other non-standard form.
HTML
# Microsoft
Front-End-Https: on
X-Forwarded-Protocol: http
X-Forwarded-Ssl: on
X-Url-Scheme: http
|
Note: This HTTP headers X-Forwarded-Proto is useful when you want to keep a record of the protocol client and load balancer.
Supported Browsers: Compatibility for the HTTP headers X-Forwarded-Proto for the browsers still unknown.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
07 Nov, 2020
Like Article
Save Article