Login to webadmin behind nginx reverse proxy results in "Your browser does not have cookies enabled for this site!" #752

Closed
opened 2026-10-05 04:42:41 +02:00 by adam · 6 comments
Owner

OS: Ubuntu Xenial 16.04.1
znc version: 1.6.4

TrustedProxy = 127.0.0.1 is in znc.conf

nginx vhost config:

server {
    listen 80;
    listen [::]:80;
    server_name znc.mydomain.com;

    location / {
        proxy_pass https://127.0.0.1:6667;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Attempting to log in to webadmin via znc.mydomain.com results in the error Your browser does not have cookies enabled for this site! and a failed login. Logging into web admin by pointing a browser to the ip:port works fine.

OS: Ubuntu Xenial 16.04.1 znc version: 1.6.4 `TrustedProxy = 127.0.0.1` is in `znc.conf` nginx vhost config: ``` server { listen 80; listen [::]:80; server_name znc.mydomain.com; location / { proxy_pass https://127.0.0.1:6667; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } ``` Attempting to log in to webadmin via `znc.mydomain.com` results in the error `Your browser does not have cookies enabled for this site!` and a failed login. Logging into web admin by pointing a browser to the ip:port works fine. <!-- github-sync-id:203569717 -->
adam closed this issue 2026-10-05 04:42:41 +02:00
Author
Owner

No problems here. I have configured a seperate listener for the Webinterface.

Version = 1.7.x

<Listener listener0>
        AllowIRC = false
        AllowWeb = true
        Host = 127.0.0.1
        IPv4 = true
        IPv6 = false
        Port = 21212
        SSL = false
        URIPrefix = /znc/
</Listener>
        location /znc/ {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_pass http://127.0.0.1:21212;
        }

Btw, you don't need TLS encryption for http on localhost. Let nginx handle that. That may also be the origin of your error.

No problems here. I have configured a seperate listener for the Webinterface. ``` Version = 1.7.x <Listener listener0> AllowIRC = false AllowWeb = true Host = 127.0.0.1 IPv4 = true IPv6 = false Port = 21212 SSL = false URIPrefix = /znc/ </Listener> ``` ``` location /znc/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://127.0.0.1:21212; } ``` Btw, you don't need TLS encryption for http on localhost. Let nginx handle that. That may also be the origin of your error. <!-- github-comment-id:275711336 -->
Author
Owner

@bjoe2k4 thanks for the help! I had originally tried without TLS encryption for http on localhost, but it resulted in 502 errors from nginx, which was equally as confusing. Enabling it seems to be the only way to get the webadmin login page to show up, but then I hit the cookie issue.

Here's a snippet of my znc.conf:

<Listener listener0>
        AllowIRC = true
        AllowWeb = true
        IPv4 = true
        IPv6 = false
        Port = 6667
        SSL = true
        URIPrefix = /
</Listener>

I'm configuring nginx so it reverse proxies to a subdomain rather than a subURL, though I have tried the subURL method with similar results. I also have the webadmin and irc protocol on the same listener.

I have a self signed cert for znc if that matters, but I'm trying to get this reverse proxy working so I can migrate to letsencrypt (which only accepts (sub)domains IIRC).

@bjoe2k4 thanks for the help! I had originally tried without TLS encryption for http on localhost, but it resulted in 502 errors from nginx, which was equally as confusing. Enabling it seems to be the only way to get the webadmin login page to show up, but then I hit the cookie issue. Here's a snippet of my `znc.conf`: ``` <Listener listener0> AllowIRC = true AllowWeb = true IPv4 = true IPv6 = false Port = 6667 SSL = true URIPrefix = / </Listener> ``` I'm configuring nginx so it reverse proxies to a [subdomain](http://wiki.znc.in/Reverse_proxy#As_a_subdomain) rather than a [subURL](http://wiki.znc.in/Reverse_proxy#As_a_subURL), though I have tried the subURL method with similar results. I also have the webadmin and irc protocol on the same listener. I have a self signed cert for znc if that matters, but I'm trying to get this reverse proxy working so I can migrate to letsencrypt (which only accepts (sub)domains IIRC). <!-- github-comment-id:275733809 -->
Author
Owner

Try enabling debug logging on nginx side, to see what headers it sends and receives, and check what headers browser sends and receives, e.g. with Firebug.

Try enabling debug logging on nginx side, to see what headers it sends and receives, and check what headers browser sends and receives, e.g. with Firebug. <!-- github-comment-id:275879243 -->
Author
Owner

When you have more details to reproduce, reopen.

When you have more details to reproduce, reopen. <!-- github-comment-id:298441023 -->
Author
Owner

I got this error after I had logged in the webadmin with SSL enabled, then turned SSL off in config, restarted, and tried to log in again.

I just needed to delete the cookie XXXX-SessionId, where XXXX is the ZNC port number.

I got this error after I had logged in the webadmin with SSL enabled, then turned SSL off in config, restarted, and tried to log in again. I just needed to delete the cookie XXXX-SessionId, where XXXX is the ZNC port number. <!-- github-comment-id:599450897 -->
Author
Owner

I faced this issue today. No cookies were set in my browser, Brave, but when I switched to Safari it worked fine.

I faced this issue today. No cookies were set in my browser, Brave, but when I switched to Safari it worked fine. <!-- github-comment-id:2197464228 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#752