Django 1.7 http headers with Apache and WSGI




What I am trying to do:


include HTTP_AUTHORIZATION (or any custom value) in HTTP request header.




Problem:


request.META contain HTTP_AUTHORIZATION when using the development server (python manage.py runserver). But does not exist in request.META when using Apache with wsgi.




Solution:


Although Django official website mention that request headers are included inside request.META. Using Apache with WSGI, request.META will not include all the headers. The solution is to look for HTTP_AUTHORIZATION in request.environ



Comments

Popular Posts