How to set X-Forwarded-For in the browser
To send an X-Forwarded-For header from Chrome or Edge, add it as a request header in a header-editing extension such as HeaderDial and give it the IP address you want the server to see, for example 203.0.113.7. Limit it to the host you are testing. Whether the server actually uses that address depends on how it is configured to trust proxies, and that configuration is usually what you are testing.
What the header means
When a request passes through a reverse proxy or load balancer, the server behind it sees the proxy's IP address, not the visitor's. Proxies therefore add the client address to X-Forwarded-For. Each further proxy appends the address it received the request from:
X-Forwarded-For: 203.0.113.7, 198.51.100.20, 10.0.0.5
client proxy 1 proxy 2
The standardised form of the same idea is the Forwarded header (RFC 7239), for example Forwarded: for=203.0.113.7;proto=https. Some set-ups also use X-Real-IP with a single address (see how to set X-Real-IP). Find out which one your stack reads before testing.
When you need to set it yourself
- Testing country or region logic (pricing, language, content restrictions) on a staging server that derives location from the client IP.
- Checking rate limits, allow-lists and block-lists that key on client IP.
- Reproducing a bug report from a user in another network, using the IP from your logs.
- Verifying that your production stack ignores a forged header, which is a security test worth doing.
Steps
- Click the HeaderDial icon to open the popup. If the banner asks for site access, choose Allow on all sites or Only <current host>.
- Click + Request header, type
X-Forwarded-Foras the name and an address as the value. - Pick the operation. set replaces whatever value would have been sent. append adds your value to an existing one; X-Forwarded-For is one of the few request headers browsers allow appending to.
- Open Where it applies and use + Only on… with type Domain (for example
staging.example.com) so other sites don't receive the header. - To compare locations quickly, make one profile per address ("Germany", "Brazil") with +, then switch them with each profile's Active switch. If two active profiles set the same header, the leftmost chip wins.
The curl equivalent
curl -H "X-Forwarded-For: 203.0.113.7" https://staging.example.com/whoami
curl -H "Forwarded: for=203.0.113.7" https://staging.example.com/whoami
Choosing a test address
The ranges 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 are reserved for documentation. They are good for testing parsing and logging, but a geolocation database will not place them in any country. For geo tests, use a real public address from the region you need, such as one from your own access logs.
Why servers should only trust it from known proxies
X-Forwarded-For, as this guide shows. If an application takes the first address in the header at face value, any client can claim to be any IP and get around rate limits, IP allow-lists or audit logs.The safe pattern is to trust the header only when the request came directly from a proxy you operate, and to read the list from the right: skip the addresses of your own proxies, and the first address that is not yours is the client. Most frameworks and web servers implement this for you, but only once you tell them which proxies to trust. Examples are nginx's set_real_ip_from with real_ip_header, and the "trusted proxies" settings in web frameworks. Your edge proxy should also overwrite or append to the header, never pass through a client-supplied value unchanged.
A useful test: send a forged address to production and confirm that the logged client IP is still your real one.
Pitfalls
- Your proxy may rewrite it. If staging sits behind a CDN or load balancer that overwrites the header, your value never reaches the application. Check the application's logs, not the browser.
- Several headers in play. If the app reads
X-Real-IPorForwarded, setting only X-Forwarded-For changes nothing. - Remember to switch it off. Use the expiry select (for example 1 hour) or the global On/Paused switch. The badge shows "off" when HeaderDial is paused.
Add to ChromeFirefox: coming soon