See Casnode in production: Casbin Forum, with hundreds of real questions about Casbin, Casdoor, OpenAgent and Casvisor. Visit →

Casnode runs behind Nginx with TLS. Everything works, but the admin pages show 127.0.0.1 as the IP of everyone. What am I missing?

7views
2users
1 minread

Turn on trustProxyHeader = true in conf/app.local.conf, so that Casnode takes the client IP from X-Forwarded-For, and make sure Nginx sets it:

location / {
    proxy_pass http://127.0.0.1:16900;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

Only proxy to httpport. The Next.js server on httpport + 1 listens on 127.0.0.1 and gets its requests through the Go backend.

Leave trustProxyHeader off when nothing is in front of Casnode, otherwise anyone could pick their own IP with that header.

1 / 2
Oct 27