When IIS sits behind a Citrix NetScaler, your logs show the NetScaler's address instead of your visitors. NetScaler offers three ways to pass the client address on, and they behave very differently. Here is each one, with the CLI, and how to record the real client IP in the standard IIS log.
Short answer. By default NetScaler connects to your servers from one of its own addresses, a subnet IP (SNIP), so IIS logs that in c-ip. NetScaler's Insert Client IP Address option adds the real client to a request header; per service it is set service <name> -CIP ENABLED X-Forwarded-For. Name the header explicitly, because the NetScaler page we read does not state a default. IIS still ignores it, so log it as a column, as below, or validate it to correct c-ip.
On the NetScaler (CLI):
set service svc-iis-01 -CIP ENABLED X-Forwarded-For
On IIS, to see the header as a 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.
| Method | What NetScaler documents | Effect in IIS |
|---|---|---|
Client IP header-CIP ENABLED <header> | NetScaler inserts the client's address into the request header you name, per service. Whether it appends to or replaces an existing X-Forwarded-For is not stated on the page we read. | Header only. c-ip still shows the SNIP. |
USIPset service <name> -usip YES | Disabled by default. NetScaler uses the client's IP address for communication with the servers. Citrix requires the server's gateway to be a NetScaler-owned SNIP so replies return through it. In current releases, HTTP connections are not reused while USIP is on. | The connection comes from the client address, so the TCP source IIS logs in c-ip is the client's, with no header. |
| Rewrite policy | Citrix's example (CTX218061) replaces any existing X-Forwarded-For with the single client address (replace ... CLIENT.IP.SRC), and a second rule inserts the header when it is absent. Citrix's documentation also has a rewrite example that deletes old X-Forwarded-For headers. | Header only. A replace gives you one clean value rather than a chain. |
Two details to watch. A global enable ns mode USIP applies only to services created after it is set. And Use Proxy Port matters only when USIP is on: Citrix documents it as on by default for TCP-based service types, and it makes NetScaler use its own port rather than the client's as the source port while still using the client address.
Restrict IIS at the firewall to the addresses NetScaler connects from, its SNIPs, so nobody can reach the server directly and supply their own header. With USIP on, the connection arrives from client addresses, so this lock-down does not apply in the same way and you rely on network placement instead.
Winfrasoft X-Forwarded-For for IIS is an ISAPI web filter that reads the header NetScaler inserts and writes the real client address into the standard IIS c-ip log field, with no application changes and no routing changes. It is the route for estates that stay on SNAT rather than moving to USIP.
X-Forwarded-For can reach the NetScaler, test whether your configuration appends to it or replaces it, since the documentation we read does not settle that. A replace policy removes the doubt.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.
For NetScaler there is a free route that does change c-ip: USIP, described above. It costs a routing change (the server gateway must be a NetScaler-owned address) and connection reuse, so it is not always possible, but if it is, you do not need a filter for the NetScaler hop.
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 NetScaler 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.
Citrix presents the Client IP header as an option you enable per service, and the page we read names no default header, so set it explicitly with -CIP ENABLED X-Forwarded-For and confirm with a custom log field. We could not confirm a default state from an official page.
USIP makes the connection come from the client address, so c-ip is right without a header, but Citrix requires the server gateway to be a NetScaler-owned SNIP, and in current releases HTTP connections are not reused. The Client IP header keeps SNAT and routing as they are, at the cost of IIS still logging the SNIP until a filter reads the header.
The Citrix page for the setting does not say. A rewrite policy is documented separately: Citrix's example replaces the header with the single client address, and a second rule inserts it when it is absent. Test your own configuration before relying on either behaviour.
The SNIP addresses the NetScaler uses to connect to IIS, plus every other internal hop. Citrix documents that, by default, NetScaler picks the source address from a pool of SNIPs, so include the whole pool.
Log the real client IP in the standard IIS c-ip field behind Citrix NetScaler, 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.