Proxy headers
The proxy removes the X-Forwarded headers that a client sends and sets its own. Your app can trust them.
A client sends its own X-Forwarded-For header, with a false address.
The headers that the proxy sets
| Header | Value |
|---|---|
X-Forwarded-For, X-Real-IP | The address of the peer of the connection, and nothing else |
X-Forwarded-Proto | http or https |
X-Forwarded-Host | The Host that the client used |
X-Forwarded-Port | The port of that Host (else 80 or 443), not the port of the listener. Thus apps build correct URLs behind port forwarding. |
Forwarded | The same facts in RFC 7239 form |
X-Request-Id | Kept if the client sent one. If not, a random id. |
When your app can trust them
Trust these headers for requests that come through the proxy. The proxy is the only way in from outside the server, because the containers listen on 127.0.0.1.
Calls from the private network
Other containers on the private network can call your app directly. These calls do not go through the proxy.
Before the proxy sends a request to an app, it drops each of these headers of the client:
Forwarded, X-Forwarded-*, X-Real-IP, Forwarded-For, Front-End-Https, X-Url-Scheme, X-Client-IP and X-Cluster-Client-IP.
X-Forwarded-For is then the address of that proxy. Ferry does not touch the headers of a CDN, such as CF-Connecting-IP. An app can choose to use them.