Why is Django/FastCGI/Apache logging HTTP status code 200 for every request, even 404s?
- by jl6
Edit: I have now discovered that the status code is returned correctly, it just isn't recorded correctly in Apache's access.log. Title amended. This is still a problem. Any ideas? Original question follows.
Hi all.
I run the following stack: Django(svn) on WSGI on FastCGI on Apache on Dreamhost. Every page served by Django returns HTTP status code 200, even those resulting from statements such as
raise Http404
There is a .htaccess file which directs most pages to Django, via my dispatch.fcgi file, and other pages elsewhere. The other pages return correct status codes, e.g. trying to access /.htaccess itself results in status code 403.
When I run my Django project on a local development server (Apache, not Django's built-in development server), I get correct status codes, so I don't think this is caused by my Django code. My current thinking is that the problem lies somewhere in how the FastCGI/WSGI interface is configured, but I'm not sure how to proceed debugging this. Any tips on how I can find out what's causing this?