Nginx Django csrf_token get 502 error invalid header

I have a Django site developed using Pinax. When I deploy it in apache+mod_wsgi, it works fine. But when I deploy it in nginx+uwsgi, it nearly works fine, but the page includes a {% csrf_token %} tag. The crashed page dose not display a Django error page, but displays an Nginx 502 error page. The Nginx error log is:

2012/06/08 09:11:59 [error] 30224#0: *79 upstream sent invalid header while reading response header from upstream, client: 211.142.12.3, server: mysite.com, request: "GET /discuss/ HTTP/1.1", upstream: "uwsgi://127.0.0.1:9001", host: "mysite.com", referrer: "http://mysite.com/"

uwsgi displays:

{address space usage: 42319872 bytes/40MB} {rss usage: 22573056 bytes/21MB} [pid: 21398|app: 0|req: 1/3] 110.178.82.221 () {42 vars in 988 bytes} [Fri Jun 8 18:27:01 2012] GET /discuss/ => generated 31139 bytes in 2306 msecs (HTTP/1.1 200) 5 headers in 358 bytes (1 switches on core 0)

The error occurs on a GET request, not a POST request. I tested this - when I delete the csrf_token token from the template, it's OK. So, there must be a relationship between the token and the error, not anything else.

What's going on?

Answers


Okay, it's solved. I had installed uwsgi by compiling the source. Now I delete that version, and reinstall it using pip install uwsgi, and everything is fine!


Need Your Help

IndyHandle to TIDPEERTHREAD

delphi delphi-7 indy indy-9

I am using Indy9 with Delphi7.

UIImageView center not updating properly

ios objective-c uiimageview

I'm practicing some iOS programming. I'm looking to move a UIImageView object to a given position on the screen. The storyboard contains