Skip to content

fix reverse proxy trust and client IP logging - #608

Merged
crazy-max merged 1 commit into
librenms:masterfrom
crazy-max:fix-reverse-proxy-peer
Nov 17, 2026
Merged

crazy-max merged 1 commit into
librenms:masterfrom
crazy-max:fix-reverse-proxy-peer

Conversation

@crazy-max

Copy link
Copy Markdown
Member

Preserve the original connection address and port when passing requests to PHP-FPM. Rewriting REMOTE_ADDR to the client address prevented LibreNMS from recognizing trusted proxies, causing HTTPS requests to generate HTTP URLs.

Generate Nginx's proxy trust rules from LibreNMS's cached configuration so APP_TRUSTED_PROXIES controls both forwarded-header handling and client IP logging. Keep PHP-FPM environment clearing enabled.

Retain REAL_IP_FROM as an explicit logging override, while treating the legacy 0.0.0.0/32 placeholder as automatic configuration. Validate generated IP and CIDR entries so malformed settings cannot break Nginx startup.

Remove the hard-coded Traefik network and subnet, and log the validated client address instead of the raw forwarded header.

@crazy-max
crazy-max force-pushed the fix-reverse-proxy-peer branch from 1045cd8 to b7aa466 Compare November 15, 2026 08:55
@crazy-max
crazy-max requested a review from murrant November 15, 2026 08:56
@crazy-max
crazy-max marked this pull request as ready for review November 15, 2026 08:58
Preserve the original connection address and port when passing requests to
PHP-FPM. Rewriting REMOTE_ADDR to the client address prevented LibreNMS from
recognizing trusted proxies, causing HTTPS requests to generate HTTP URLs.

Generate Nginx's proxy trust rules from LibreNMS's cached configuration so
APP_TRUSTED_PROXIES controls both forwarded-header handling and client IP
logging. Keep PHP-FPM environment clearing enabled.

Retain REAL_IP_FROM as an explicit logging override, while treating the
legacy 0.0.0.0/32 placeholder as automatic configuration. Validate generated
IP and CIDR entries so malformed settings cannot break Nginx startup.

Remove the hard-coded Traefik network and subnet, and log the validated
client address instead of the raw forwarded header.
@crazy-max
crazy-max force-pushed the fix-reverse-proxy-peer branch from b7aa466 to 0a1730d Compare November 16, 2026 09:37
@crazy-max
crazy-max merged commit d0a2f3f into librenms:master Nov 17, 2026
10 checks passed
@crazy-max
crazy-max deleted the fix-reverse-proxy-peer branch November 17, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect protocol sent over reverse proxy

2 participants