How to setup Wt and nginx to get real Ip-addresses?
Added by Boris Nagaev almost 14 years ago
Current nginx config:
location / {
proxy_pass http://localhost:8004/;
proxy_redirect default;
proxy_set_header Client-IP $remote_addr;
}
Wt config:
<behind-reverse-proxy>true</behind-reverse-proxy>
But I still have 127.0.0.1
in logs...
Replies (1)
RE: How to setup Wt and nginx to get real Ip-addresses? - Added by Koen Deforche almost 14 years ago
Hey,
The log file (access log) is actually generated by the web server, and not by Wt itself. The webserver will simply log the IP address. I agree it is a good idea to let the http server also honor the behind-reverse-proxy setting of Wt. The current organisation is historical: Wt got its built-in HTTP server only later.
The actual reading of Client-IP and X-Forwarded-For header is done for the WEnvironment::clientAddress(). This will however only work reliably for non-local addresses, I notice now. I've fixed this in git.
Regards,
koen