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.
- <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:
Example 2: The following example contains an X-Forwarded-Proto request header for a request that originated from the client as an HTTPS request:
Example 3: This example is for other non-standard form.
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.