Blog Logo
  • Home
  • About

mod_wsgi and the HTTP Authorization header

by Drew Engelson — 07 Apr 2011

If one is building a WSGI application on mod_wsgi and one wants this WSGI application to handle HTTP authentication, it is likely that one will need access to the "Authorization" HTTP header at some point. Had one read the documentation, one would have already understood that mod_wsgi does not pass this header to your WSGI application by default. This is probably a very good thing.

To tell mod_wsgi to pass the Authorization header through to your application, just set the mod_wsgi configuration directive WSGIPassAuthorization to "On".

# enable authorization headers
WSGIPassAuthorization On

# set up wsgi app
WSGIApplicationGroup myapp-1
WSGIImportScript /projects/myapp/myapp.wsgi application-group=myapp-1 process-group=myapp-1
WSGIScriptAlias /myapp /projects/myapp/myapp.wsgi

| Note to self (and others who may have wasted time on such things):

Read The Docs!

Drew Engelson
Author

Drew Engelson

https://tomatohater.com

I currently lead the Cloud Foundation Services team at Starbucks. We are building the Starbucks PaaS to allow digital platforms to be deployed globally with a focus on automation, scalability, performance, security, and developer experience.

Prior to Starbucks, I led Celerity's Technology Innovation and Architecture practice and founded Zoombit and served in technology leadership at Huge and PBS.

Yes. I seriously hate tomatoes.

All content copyright Tomatohater © 2006-2021 • All rights reserved.
0.06g of CO2/viewWebsite Carbon
 Cleaner than 95% of pages tested