Show IP of Client when behind a remote proxy #629

Closed
opened 2026-10-05 04:34:54 +02:00 by adam · 7 comments
Owner

When using the URIPrefix and allowing web access through a reverse proxy (Apache), the header shows "Logged in as: User (from 127.0.01)" where in this case the proxy is on the same host.

I'd like the web interface to be show the client's true address by using the "X-Forwarded-For" header.

I'm digging into the code to put together a patch but any pointers would be appreciated.

When using the URIPrefix and allowing web access through a reverse proxy (Apache), the header shows "Logged in as: User (from 127.0.01)" where in this case the proxy is on the same host. I'd like the web interface to be show the client's true address by using the "X-Forwarded-For" header. I'm digging into the code to put together a patch but any pointers would be appreciated. <!-- github-sync-id:113204540 -->
adam closed this issue 2026-10-05 04:34:54 +02:00
Author
Owner

What version are you on? I run webadmin through an nginx reverse proxy and I see my real IP in the header.

*status ZNC - 1.6.0 - http://znc.in
*status IPv6: yes, SSL: yes, DNS: threads, charset: yes

That said, I have to set the X-Forwarded-For header before the proxy_pass, so perhaps there's something similar you need to do for Apache to pass it through?

What version are you on? I run webadmin through an nginx reverse proxy and I see my real IP in the header. ``` *status ZNC - 1.6.0 - http://znc.in *status IPv6: yes, SSL: yes, DNS: threads, charset: yes ``` That said, I have to set the `X-Forwarded-For` header before the `proxy_pass`, so perhaps there's something similar you need to do for Apache to pass it through? <!-- github-comment-id:150889777 -->
Author
Owner

ZNC 1.6.1+deb1~ubuntu14.04.0 - http://znc.in
IPv6: yes, SSL: yes, DNS: threads, charset: yes

Maybe there is another Apache setting I need.

ZNC 1.6.1+deb1~ubuntu14.04.0 - http://znc.in IPv6: yes, SSL: yes, DNS: threads, charset: yes Maybe there is another Apache setting I need. <!-- github-comment-id:150890316 -->
Author
Owner

I just confirmed using tcpdump that the Apache proxy is making a request with X-Forwarded-For set to my IP correctly.

I just confirmed using tcpdump that the Apache proxy is making a request with X-Forwarded-For set to my IP correctly. <!-- github-comment-id:150891320 -->
Author
Owner

Perhaps mine works because of the line TrustedProxy = 127.0.0.1 in znc.conf. I don't believe any TrustedProxies are set by default.

Perhaps mine works because of the line `TrustedProxy = 127.0.0.1` in znc.conf. I don't believe any TrustedProxies are set by default. <!-- github-comment-id:150891469 -->
Author
Owner

@dgw Yes! TrustedProxy was the key to making it work! Thank you!

@dgw Yes! TrustedProxy was the key to making it work! Thank you! <!-- github-comment-id:150891643 -->
Author
Owner

You're quite welcome :)

You're quite welcome :) <!-- github-comment-id:150891665 -->
Author
Owner

Related issues:

  • Some options are only in webadmin/controlpanel/znc.conf, nowhere else #1128
  • Always trust reverse proxy on localhost without additional configuration #1126
    • closed as potentially bad idea.
Related issues: - Some options are only in webadmin/controlpanel/znc.conf, nowhere else #1128 - Always trust reverse proxy on localhost without additional configuration #1126 - closed as potentially bad idea. <!-- github-comment-id:150897859 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#629