Pylons and Apache with repoze.who BasicAuth

To be able to use Basic Authentification in repoze.who running in a wsgi
app in your Apache installation, you need to tell Apache to
WSGIPassAuthorization. An Apache configuration like this will do:

# Setup mod_wsgi
WSGIPythonHome /var/www/pylons/runtime
WSGIScriptAlias /myApp /var/www/pylons/myApp/mod_wsgi/dispatch.wsgi
WSGIPassAuthorization On

<directory /var/www/pylons/myApp/mod_wsgi>
Order deny,allow
Allow from all

The importanat part here is

WSGIPassAuthorization On

This will pass HTTP authorisation headers through to the WSGI

Sources: Repoze-dev Mailing List, modwsgi Wiki

  • Joe Knapka

    Thank you! My app was working fine with repoze.who using its internal HTTP server, but under Apache2+mod_wsgi it just repetitively popped up the authentication dialog. Setting WSGIPassAuthorization in the Apache configuration was the magic I needed.