When IIS is the origin behind Fastly, your logs show Fastly addresses instead of your visitors. Here is what Fastly puts in X-Forwarded-For and Fastly-Client-IP, why neither can be trusted on its own, and how to record the real client IP in the standard IIS log.
Short answer. Fastly's X-Forwarded-For reference says an existing value is preserved, so Fastly appends to the chain and anything the caller sent stays at the left. Fastly also documents a proprietary Fastly-Client-IP header, which its page says is not protected from modification at the edge. IIS reads neither, and c-ip records a Fastly address. Log the header as a column to see the visitor, as below, or validate the chain against Fastly's published ranges to correct c-ip itself.
To see the visitor in your log today, add the header as a custom column (elevated PowerShell):
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' `
-filter "system.applicationHost/sites/siteDefaults/logFile/customFields" `
-name "." `
-value @{logFieldName='X-Forwarded-For';sourceName='X-Forwarded-For';sourceType='RequestHeader'}
It adds a cs(X-Forwarded-For) column and does not change c-ip. Only need the column? The free custom log field covers that, and the section below says where it stops being enough.
| Header | What Fastly documents |
|---|---|
X-Forwarded-For | Any existing value is preserved and Fastly appends to it, but only on secure (TLS) connections: a plain HTTP client or backend leaves the chain unchanged. In Fastly's worked example the origin receives the client, then a proxy, then the edge POP. The leftmost entry is whatever the caller claimed. |
Fastly-Client-IP | A proprietary header that Fastly's reference page describes for CDN services (the page does not mention Compute). If it is missing, Fastly sets it from client.ip. Fastly's page says the value is not protected from modification at the edge, so a caller who sends it can have their value used unless your VCL overrides it. Whether it is forwarded to your origin by default is not stated clearly, so check a live request. |
Fastly documents an override for the second header in vcl_recv, so a forged value is replaced by Fastly's view of the client on the first visit. Compare this with the current Fastly page before using it, because service types differ (Fastly says Compute services do not get the automatic X-Forwarded-For behaviour):
if (fastly.ff.visits_this_service == 0 && req.restarts == 0) {
set req.http.Fastly-Client-IP = client.ip;
}
Fastly's shielding documentation says a shield POP sees the edge POP's address rather than the user's, and points to Fastly-Client-IP for the true client. If you use shielding, more than one Fastly address can sit between the visitor and IIS, so check what arrives rather than assuming a single hop.
Fastly publishes its address ranges as JSON at api.fastly.com/public-ip-list, with IPv4 under addresses and IPv6 under ipv6_addresses, and describes the list as the addresses to allow for connections from Fastly to your origin. Changes are announced ahead of time on Fastly's status page. Allowing the whole list covers every Fastly hop, including a shield, though that reading is ours rather than a Fastly statement.
For a stronger check than an address list, Fastly documents configuring a TLS client certificate on the backend host so the origin can require that connections come from Fastly, and its page names IIS among the servers it has setup guides for.
Winfrasoft X-Forwarded-For for IIS is an ISAPI web filter that reads the header Fastly sends and writes the real client address into the standard IIS c-ip log field, with no application changes and no second log file.
X-Forwarded-For and, if it reaches you, Fastly-Client-IP as custom fields for a day, and make requests with and without a made-up X-Forwarded-For of your own to see what survives.c-ip holds the client address.If all you need is the address somewhere in the log, IIS 8.5 and later can record the header as an extra column with no product, using the snippet at the top of this page. That appends a cs(X-Forwarded-For) column to the W3C log. It does not change c-ip.
It stops being enough when:
c-ip. SIEM connectors, geo-IP reporting and compliance parsers key off the standard field, so they carry on seeing a Fastly address. A new column means changing every one of them; rewriting c-ip changes none.The click-through steps, and the log-file naming caveat, are in how to log X-Forwarded-For in IIS. If any of the points above applies, X-Forwarded-For for IIS 10 is the supported way to put the validated client address into c-ip itself.
X-Forwarded-For, to which Fastly appends, and a proprietary Fastly-Client-IP header that Fastly sets when it is missing. Fastly's documentation does not clearly say that the second one is forwarded to your origin by default, so check a live request.
According to Fastly's reference page the value is not protected from modification at the edge, so a caller can supply one and have it used unless your VCL overrides it. Fastly documents a vcl_recv override that sets it from client.ip on the first visit.
Because Fastly preserves an existing value and appends to it, whatever the caller sent stays at the left of the chain. Only the entries Fastly adds can be trusted, which is why a filter should walk the chain from the right against a trust list.
The ranges at api.fastly.com/public-ip-list, plus every internal hop between Fastly and IIS. With shielding enabled, allowing the whole list covers both the edge and the shield. Refresh it when Fastly announces a change.
Log the real client IP in the standard IIS c-ip field behind Fastly, with a Proxy Trust List so the value is validated rather than merely copied. IIS 10 on Windows Server 2016–2025, with a free 14-day trial.
Stuck on your setup? Email us with your proxy and what c-ip shows, and we will take a look.