When IIS sits behind a FortiWeb web application firewall in reverse proxy mode, your logs show FortiWeb's address instead of your visitors. FortiWeb can pass the client address in a header or preserve it at the connection level, and the documentation for the two modes does not fully agree. Here is what each setting does.
Short answer. In reverse proxy mode FortiWeb opens its own connection to IIS, so c-ip records the FortiWeb address. Fortinet's CLI reference lists x-forwarded-for-support and x-real-ip for FortiWeb, both disabled by default, and its Administration Guide says FortiWeb adds the source IP of the connection to X-Forwarded-For, appending to any existing list. Turn on Add X-Forwarded-For, then log the header as a column, as below, or validate it 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.
| Mode | What Fortinet documents |
|---|---|
| Reverse proxy | The web server sees FortiWeb's IP address as the source of incoming requests. Add X-Forwarded-For applies here. |
| True transparent proxy | Fortinet's operation-mode page says the back-end server sees the client's original IP. Its X-Forwarded-For section lists this mode as applying source network address translation. The two statements conflict, so test a transparent deployment and send the header as well. |
| WCCP | The web server sees the FortiWeb network interface IP address, not the client's, as in reverse proxy mode. |
| Offline protection | We could not confirm the source address IIS sees from Fortinet's pages. Check a live request. |
Add X-Forwarded-For and Add X-Real-IP sit under FortiWeb's X-Forwarded-For settings (CLI: config waf x-forwarded-for with set x-forwarded-for-support enable). Fortinet's 7.2 CLI reference gives the default for both as disabled, and its Administration Guide says they apply only in reverse proxy or true transparent proxy mode. Add X-Real-IP does not support IPv6. In current releases the guide also lists Delete Previous XFF Headers and Merge Previous XFF Headers (if both are enabled, Merge has no effect because Delete runs first); these are not in the 7.2 CLI reference, and Fortinet does not state which behaviour applies by default, so test whether a client-supplied value survives.
Client Real IP, in the server policy's network configuration, is the alternative that needs no header. Fortinet's 7.0 Administration Guide says FortiWeb then uses the source IP address of the client that originated the request, that it is available only in reverse proxy mode, and that it requires FortiWeb to be the server's gateway. It also notes it is unsupported when the backend is addressed by domain name rather than IP address, and advises against enabling it if the server's IP is used as the source address in a policy route. With it on, the connection IIS sees comes from the client, so c-ip is correct without a header.
Menu names and defaults change between FortiWeb releases; the versions cited here are 7.0, 7.2 and 8.0, so confirm against yours.
Winfrasoft X-Forwarded-For for IIS is an ISAPI web filter that reads the header FortiWeb adds and writes the real client address into the standard IIS c-ip log field, with no application changes and no change to FortiWeb's gateway arrangement. It suits estates that cannot or do not want to use Client Real IP.
c-ip now 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 FortiWeb 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.
No. Fortinet's 7.2 CLI reference gives the default for x-forwarded-for-support and x-real-ip as disable, so IIS sees only FortiWeb's address until you turn Add X-Forwarded-For on.
A server policy option that makes FortiWeb use the source IP address of the client that originated the request when it connects to the server. Fortinet says it is available only in reverse proxy mode and requires FortiWeb to be the server's gateway. IIS then logs the client directly in c-ip.
Fortinet's Administration Guide says FortiWeb appends the source IP address to the header's list, and lists Delete Previous XFF Headers and Merge Previous XFF Headers options. Which applies by default we could not confirm, so test with a made-up value of your own.
The addresses FortiWeb uses to connect to IIS, plus every other internal hop between FortiWeb and the server. In reverse proxy mode that is FortiWeb's own address on the server-facing side.
Log the real client IP in the standard IIS c-ip field behind FortiWeb, 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.