In proxy chaining environments, the upstream (or parent) proxy logs all traffic as originating from the downstream (or child) proxy. To have the upstream proxy log the originating client's IP in its access logs, modify both the downstream and upstream proxies. The modification is to configure the downstream proxy to add an HTTP header showing the originating client's IP, and to configure policy on the upstream proxy to modify access logging based on this added header.
To set this up, perform the following:
On the downstream ProxySG (the proxy that the clients communicate to first):
- Issue the following command in the CLI:
ProxySG#(config) http add-header x-forwarded-for
On the upstream ProxySG:
- In the VPM, create a new Web Access Layer by selecting Policy > Add Web Access Layer.
- Right-click the Source field and select Set > New > Request Header.
Header Name: X-forwarded-For
Header Regex: . (note there is a dot here)
- Right-click the Action field and select Set > Override Access Log Field.
Log Name: [All]
Field Name: c-ip
rewrite value to:$(request.header.X-Forwarded-For)
- Install the policy.