nginx keeps passing the same http_cookie to uwsgi

jeff thomas mrwzl at yahoo.com
Mon Jun 18 23:33:52 UTC 2012


Another request in a completely fresh browser:

Request Headers:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Host:fire.domain.com
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5


uwsgi output of the environment:
{'UWSGI_CHDIR': '/ebs/py', 'HTTP_X_WAP_PROFILE': 'http://uaprof.vtext.com/mot/a956/a956.xml', 'HTTP_REFERER': 'http://www.facebook.com/', 'UWSGI_SCRIPT': 'server', 'uwsgi.version': '1.1.2', 'REQUEST_METHOD': 'GET', 'PATH_INFO': '/redirect/8ddcc113-092e-46ce-845b-462b825ea792', 'SERVER_PROTOCOL': 'HTTP/1.1', 'QUERY_STRING': '', 'x-wsgiorg.fdevent.readable': <built-in function uwsgi_eventfd_read>, 'CONTENT_LENGTH': '', 'uwsgi.ready_fd': None, 'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'HTTP_CONNECTION': 'close', 'HTTP_COOKIE': 'ge_t_c=4fcee8450c3bee709800920c', 'SERVER_NAME': 'pixel.domain.com', 'REMOTE_ADDR': '10.load.bal.ip', 'HTTP_X_BLUECOAT_VIA': '442C08A7416C4033', 'wsgi.url_scheme': 'http', 'SERVER_PORT': '80', 'wsgi.multiprocess': True, 'uwsgi.node': 'pyfire-1.domain.com', 'DOCUMENT_ROOT': '/etc/nginx/html', 'UWSGI_PYHOME': '/ebs/py',
 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'uwsgi.core': 127, 'HTTP_X_FORWARDED_PROTO': 'http', 'x-wsgiorg.fdevent.writable': <built-in function uwsgi_eventfd_write>, 'wsgi.input': <newrelic.api.web_transaction.WSGIInputWrapper object at 0x17df650>, 'HTTP_HOST': 'fire.domain.com', 'wsgi.multithread': False, 'HTTP_UA_CPU': 'AMD64', 'HTTP_CACHE_CONTROL': 'max-stale=0', 'REQUEST_URI': '/redirect/8ddcc113-092e-46ce-845b-462b825ea792', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'wsgi.version': (1, 0), 'x-wsgiorg.fdevent.timeout': None, 'HTTP_X_FORWARDED_FOR': '10.load.bal.ip', 'wsgi.errors': <open file 'wsgi_errors', mode 'w' at 0x19955d0>, 'REMOTE_PORT': '51791', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8', 'wsgi.run_once': False, 'HTTP_X_FORWARDED_PORT': '80', 'CONTENT_TYPE': '', 'wsgi.file_wrapper': <built-in function uwsgi_sendfile>, 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch'}

----- Original Message -----
From: jeff thomas <mrwzl at yahoo.com>
To: "nginx at nginx.org" <nginx at nginx.org>
Cc: 
Sent: Monday, June 18, 2012 4:26 PM
Subject: nginx keeps passing the same http_cookie to uwsgi

I have a small python app running via uwsgi with requests served by nginx. 

I'm printing the environment variables... and it looks like after a couple of ok requests, nginx is sending the same HTTP_COOKIE param for unrelated requests:

For example:
{'UWSGI_CHDIR': '/ebs/py', 'HTTP_COOKIE': 'ge_t_c=4fcee8450c3bee709800920c', 'UWSGI_SCRIPT': 'server', 'uwsgi.version': '1.1.2', 'REQUEST_METHOD': 'GET', 'PATH_INFO': '/redirect/ebebaf3b-475a-4010-9a72-96eeff797f1e', 'SERVER_PROTOCOL': 'HTTP/1.1', 'QUERY_STRING': '', 'x-wsgiorg.fdevent.readable': <built-in function uwsgi_eventfd_read>, 'CONTENT_LENGTH': '', 'uwsgi.ready_fd': None, 'HTTP_USER_AGENT': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)', 'HTTP_CONNECTION': 'close', 'HTTP_REFERER': 'http://www.facebook.com/', 'SERVER_NAME': 'pixel.domain.com', 'REMOTE_ADDR': '10.load.bal.ip', 'wsgi.url_scheme': 'http', 'SERVER_PORT': '80', 'wsgi.multiprocess': True, 'uwsgi.node': 'py.domain.com', 'DOCUMENT_ROOT': '/etc/nginx/html', 'UWSGI_PYHOME': '/ebs/py', 'uwsgi.core': 127, 'HTTP_X_FORWARDED_PROTO': 'http', 'x-wsgiorg.fdevent.writable': <built-in function uwsgi_eventfd_write>, 'wsgi.input':
<newrelic.api.web_transaction.WSGIInputWrapper object at 0x1809b90>, 'HTTP_HOST': 'track.domain.com', 'wsgi.multithread': False, 'REQUEST_URI': '/redirect/ebebaf3b-475a-4010-9a72-96eeff797f1e', 'HTTP_ACCEPT': 'text/html, application/xhtml+xml, */*', 'wsgi.version': (1, 0), 'x-wsgiorg.fdevent.timeout': None, 'HTTP_X_FORWARDED_FOR': '10.load.bal.ip', 'wsgi.errors': <open file 'wsgi_errors', mode 'w' at 0x1995390>, 'REMOTE_PORT': '36462', 'HTTP_ACCEPT_LANGUAGE': 'en-US', 'wsgi.run_once': False, 'HTTP_X_FORWARDED_PORT': '80', 'CONTENT_TYPE': '', 'wsgi.file_wrapper': <built-in function uwsgi_sendfile>, 'HTTP_ACCEPT_ENCODING': 'gzip, deflate'}



and

 {'UWSGI_CHDIR': '/ebs/py', 'HTTP_COOKIE': 'ge_t_c=4fcee8450c3bee709800920c', 'UWSGI_SCRIPT': 'server', 'uwsgi.version': '1.1.2','REQUEST_METHOD': 'GET', 'PATH_INFO': '/redirect/2391e658-95ef-4300-80f5-83dbb1a0e526', 'SERVER_PROTOCOL': 'HTTP/1.1', 'QUERY_STRING': '', 'x-wsgiorg.fdevent.readable': <built-in function uwsgi_eventfd_read>, 'CONTENT_LENGTH': '', 'uwsgi.ready_fd': None, 'HTTP_USER_AGENT': 'Mozilla/5.0 (iPad; CPU OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3', 'HTTP_CONNECTION':
 'close', 'HTTP_REFERER': 'http://www.facebook.com/', 'SERVER_NAME': 'pixel.domain.com', 'REMOTE_ADDR': '10.load.balancer.ip',
 'wsgi.url_scheme': 'http', 'SERVER_PORT': '80', 'wsgi.multiprocess': True, 'uwsgi.node': 'py.domain.com', 'DOCUMENT_ROOT':
 '/etc/nginx/html', 'UWSGI_PYHOME': '/ebs/py', 'uwsgi.core': 127, 'HTTP_X_FORWARDED_PROTO': 'http', 'x-wsgiorg.fdevent.writable':
 <built-in function uwsgi_eventfd_write>, 'wsgi.input': <newrelic.api.web_transaction.WSGIInputWrapper object at 0x18f3850>, 'HTTP_HOST': 'fire.domain.com', 'wsgi.multithread': False, 'REQUEST_URI': '/redirect/2391e658-95ef-4300-80f5-83dbb1a0e526',
 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'wsgi.version': (1, 0), 'x-wsgiorg.fdevent.timeout': None,
 'HTTP_X_FORWARDED_FOR': '10.load.bal.ip', 'wsgi.errors': <open file 'wsgi_errors', mode 'w' at 0x1796e40>, 'REMOTE_PORT': '39498',
 'HTTP_ACCEPT_LANGUAGE': 'en-us', 'wsgi.run_once': False, 'HTTP_X_FORWARDED_PORT': '80', 'CONTENT_TYPE': '', 'wsgi.file_wrapper': <built-in function uwsgi_sendfile>, 'HTTP_ACCEPT_ENCODING': 'gzip, deflate'}

These are 2 distinct clients. I opened an incognito session, confirmed that no cookie was sent in the headers, and the uwsgi log shows that it received the same HTTP_COOKIE.

How can I make sure that nginx only passes the proper information for the current request, without regard to other requests?

_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx




More information about the nginx mailing list