Open In App
Related Articles

HTTP headers | X-Forwarded-Proto

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

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.
 



Last Updated : 07 Nov, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads