Hi,
I'm trying to use pyramid_debugtoolbar with nginx and gunicorn, talking
on a unix domain socket. This makes an empty REMOTE_ADDR, and I wonder
how can I make pyramid_debugtoolbar work.
I checked that request.remote_addr is empty, while request.client_addr
contains my browser's IP address.
nginx.conf:
location /hello {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unix:/tmp/gunicorn.hello.sock;
}
development.ini:
[app:main]
pyramid.includes = pyramid_debugtoolbar
debugtoolbar.hosts =
0.0.0.0/0 ::/0
[server:main]
use = egg:gunicorn#main
workers = 1
bind = unix:/tmp/gunicorn.hello.sock
Of course I use other means to restrict access (TLS client certificates
verified by nginx) to this application.
I also tried commenting out this 'if' in toolbar.py:
https://github.com/Pylons/pyramid_debugtoolbar/blob/master/pyramid_debugtoolbar/toolbar.py#L201
And that made debugtoolbar to appear as expected.
What is the correct way to set up pyramid_debugtoolbar with nginx and
gunicorn and unix domain sockets?
András