Production trusted edge proxy¶
Production uses two nginx layers with different responsibilities:
edgeruns with host networking and owns public port 80. It can see the actual TCP peer, trusts forwarded addresses only from the documented Mikrus proxy range, and overwritesX-Forwarded-Forwith the sanitized client address.gatewayis bound only to127.0.0.1:8080. It performs hostname and path routing and passes the already-sanitized address to the application services.
Both layers validate or generate the correlation headers X-Request-Id and
traceparent with the same rules; the edge's ids are valid, so the gateway
keeps them and both access logs (JSON) carry the same request id. See the
wiki page "Tracing a request" (docs-site/docs/operations/tracing.md).
This separation is required because Docker's IPv6-to-IPv4 userland proxy makes all traffic inside an ordinary bridge container appear to originate at the Docker bridge gateway. Without the host-network edge, direct origin callers and the Mikrus proxy are indistinguishable to the application gateway.
The trusted range comes from the Mikrus real-IP guidance:
https://wiki.mikr.us/nginx_ograniczenie_dostepu_po_ip/
Verification¶
Run the regression check:
It sends a deliberately forged X-Forwarded-For header through an untrusted
peer and verifies that the upstream receives the socket address instead of the
forged value.
Before changing the trusted range, capture the production source address at the host boundary and confirm it against current Mikrus documentation. Never add a broad trusted range merely to make a forwarded address appear correct.