[GH-ISSUE #436] Problem with installation / configuration #314

Closed
opened 2026-02-26 10:30:46 +03:00 by kerem · 2 comments
Owner

Originally created by @SirColin on GitHub (Jul 30, 2019).
Original GitHub issue: https://github.com/nsupdate-info/nsupdate.info/issues/436

I am using the following setup Django 1.11.22 + Gnunicorn 19.9.0 + Ngnix 1.14.0 (Ubuntu)

When I visit https://www.example.com, I get the following error:

Exception Type: KeyError at /
Exception Value: 'REMOTE_ADDR'

Gunicorn is involved in a socket in Nginx server unix:/srv/nsupdate/run/gunicorn.sock fail_timeout=0;

etc/ngnix/sites-available/nsupdate contains the following values

proxy_set_header Host $host; proxy_set_header User-Agent $http_user_agent; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE_ADDR $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme;

but REMOTE_ADDR is not displayed in the META request.

Variable Value
CSRF_COOKIE 'xxxxxxxxxx'
CSRF_COOKIE_USED True
HTTP_ACCEPT 'text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8'
HTTP_ACCEPT_ENCODING 'br, gzip, deflate'
HTTP_ACCEPT_LANGUAGE 'de-de'
HTTP_AUTHORIZATION 'Basic xxxxxxxxxx'
HTTP_CONNECTION 'close'
HTTP_COOKIE 'csrftoken=xxxxxxxxxx'
HTTP_HOST 'www.example.com'
HTTP_REMOTE_ADDR ''
HTTP_USER_AGENT ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, ' 'like Gecko) Version/12.1.1 Safari/605.1.15')
HTTP_X_FORWARDED_FOR 'xxx.xxx.xxx.xxx'
HTTP_X_FORWARDED_PROTO 'https'
HTTP_X_REAL_IP 'xxx.xxx.xxx.xxx'
PATH_INFO '/'
QUERY_STRING ''
RAW_URI '/'
REQUEST_METHOD 'GET'
SCRIPT_NAME ''
SERVER_NAME 'www.example.com'
SERVER_PORT '443'
SERVER_PROTOCOL 'HTTP/1.0'
SERVER_SOFTWARE 'gunicorn/19.9.0'
gunicorn.socket <socket.socket fd=9, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, laddr=/srv/nsupdate/run/gunicorn.sock>
wsgi.errors <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f0d46e176a0>
wsgi.file_wrapper ''
wsgi.input <gunicorn.http.body.Body object at 0x7f0d46e17c18>
wsgi.multiprocess False
wsgi.multithread False
wsgi.run_once False
wsgi.url_scheme 'https'
wsgi.version (1, 0)

I hope someone can help me :-)

Originally created by @SirColin on GitHub (Jul 30, 2019). Original GitHub issue: https://github.com/nsupdate-info/nsupdate.info/issues/436 I am using the following setup Django 1.11.22 + Gnunicorn 19.9.0 + Ngnix 1.14.0 (Ubuntu) When I visit https://www.example.com, I get the following error: `Exception Type: KeyError at /` `Exception Value: 'REMOTE_ADDR'` Gunicorn is involved in a socket in Nginx `server unix:/srv/nsupdate/run/gunicorn.sock fail_timeout=0;` `etc/ngnix/sites-available/nsupdate` contains the following values `proxy_set_header Host $host; proxy_set_header User-Agent $http_user_agent; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE_ADDR $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme;` but `REMOTE_ADDR` is not displayed in the META request. Variable | Value -- | -- CSRF_COOKIE | 'xxxxxxxxxx' CSRF_COOKIE_USED | True HTTP_ACCEPT | 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' HTTP_ACCEPT_ENCODING | 'br, gzip, deflate' HTTP_ACCEPT_LANGUAGE | 'de-de' HTTP_AUTHORIZATION | 'Basic xxxxxxxxxx' HTTP_CONNECTION | 'close' HTTP_COOKIE | 'csrftoken=xxxxxxxxxx' HTTP_HOST | 'www.example.com' HTTP_REMOTE_ADDR | '' HTTP_USER_AGENT | ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, ' 'like Gecko) Version/12.1.1 Safari/605.1.15') HTTP_X_FORWARDED_FOR | 'xxx.xxx.xxx.xxx' HTTP_X_FORWARDED_PROTO | 'https' HTTP_X_REAL_IP | 'xxx.xxx.xxx.xxx' PATH_INFO | '/' QUERY_STRING | '' RAW_URI | '/' REQUEST_METHOD | 'GET' SCRIPT_NAME | '' SERVER_NAME | 'www.example.com' SERVER_PORT | '443' SERVER_PROTOCOL | 'HTTP/1.0' SERVER_SOFTWARE | 'gunicorn/19.9.0' gunicorn.socket | <socket.socket fd=9, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, laddr=/srv/nsupdate/run/gunicorn.sock> wsgi.errors | <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f0d46e176a0> wsgi.file_wrapper | '' wsgi.input | <gunicorn.http.body.Body object at 0x7f0d46e17c18> wsgi.multiprocess | False wsgi.multithread | False wsgi.run_once | False wsgi.url_scheme | 'https' wsgi.version | (1, 0) I hope someone can help me :-)
kerem closed this issue 2026-02-26 10:30:46 +03:00
Author
Owner

@ThomasWaldmann commented on GitHub (Aug 1, 2019):

This is what i use on the frontend "httprelay" nginx instance (it does reverse proxy the real servers and also tls):

proxy_set_header Host $http_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;

proxy_connect_timeout 60s;
proxy_read_timeout 120s;
proxy_send_timeout 120s;

Behind that, there is another nginx without special configuration and using uwsgi for nsupdate.info.

I don't use gunicorn, so I can't help with that.

In general, maybe you get a wider audience and more feedback when asking that question on a nginx/gunicorn support site/channel.

<!-- gh-comment-id:517260629 --> @ThomasWaldmann commented on GitHub (Aug 1, 2019): This is what i use on the frontend "httprelay" nginx instance (it does reverse proxy the real servers and also tls): ``` proxy_set_header Host $http_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; proxy_connect_timeout 60s; proxy_read_timeout 120s; proxy_send_timeout 120s; ``` Behind that, there is another nginx without special configuration and using uwsgi for nsupdate.info. I don't use gunicorn, so I can't help with that. In general, maybe you get a wider audience and more feedback when asking that question on a nginx/gunicorn support site/channel.
Author
Owner

@ThomasWaldmann commented on GitHub (Dec 27, 2019):

Guess this is resolved.

<!-- gh-comment-id:569289310 --> @ThomasWaldmann commented on GitHub (Dec 27, 2019): Guess this is resolved.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nsupdate.info-nsupdate-info#314
No description provided.