HTTP Headers
X Forwarded Proto
The HTTP X-Forwarded-Proto
request header is a widely adopted standard used to identify the protocol (HTTP or HTTPS) that a client employed to connect to a proxy or load balancer.
While server access logs typically record the protocol used between the server and the load balancer, they do not show the protocol used between the client and the load balancer.
To determine this, the X-Forwarded-Proto
request header is utilized.
A more standardized version of this header is the HTTP Forwarded
header, although it is less commonly used.
Header type: Request header
Forbidden request header: No
Syntax
X-Forwarded-Proto: <protocol>
Directives
The forwarded protocol (http
or https
).
Example
Examples
X-Forwarded-Proto client protocol
The following header indicates that the original request was made over HTTPS before being forwarded by a proxy or load balancer:
X-Forwarded-Proto: https
Non-standard forms
The following forms may be seen in request headers:
# Microsoft
Front-End-Https: on
X-Forwarded-Protocol: https
X-Forwarded-Ssl: on
X-Url-Scheme: https
How to Modify Header using Requestly
Requestly is a powerful Chrome extension that allows you to Modify Headers, including the X-Forwarded-Proto header. This is especially useful for testing how your application handles requests under different protocols like HTTP or HTTPS during development or debugging. Steps to Modify the X-Forwarded-Proto Header:
- Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
- Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
- Add a new header modification:
- Under “Action”, select “Add” or “Override”.
- In the “Header Name” field, enter X-Forwarded-Proto.
- In the “Header Value” field, enter your desired protocol (e.g., https or http).
- Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-api.com/*).
- Save the rule.
Once set up, Requestly will inject the X-Forwarded-Proto header into all matching requests, allowing you to simulate different request protocols and ensure your application behaves correctly in various network environments. Modifying the X-Forwarded-Proto header is helpful when you want to test how your website or API handles requests coming through proxies or load balancers, which often use this header to indicate the original protocol of the client. This helps catch issues related to redirects, security checks, or content delivery based on HTTP vs HTTPS.
Table of Contents
- No headings found.