[Fixed]-Apache strips down "Authorization" header

43๐Ÿ‘

โœ…

I solved my problem, which finally was totally unrelated to my Apache configuration. So if you found this topic looking for an answer to the same problem, one of the solutions below should fix it :

Config WSGI :

WSGIPAssAuthorization On

Config .htaccess :

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

You can put both of those into your httpd/conf.d/project.conf file !

๐Ÿ‘คMartin Latrille

12๐Ÿ‘

Several modules will strip the Authorization header to try to enhance security by preventing scripts from seeing usernames, passwords, etcโ€ฆ unless the developer explicitly enables this. Many of these modules will allow this header if you simply add the following line to .htaccess: CGIPassAuth on (source: Apache docs and StackOverflow)

๐Ÿ‘คBeetleJuice

1๐Ÿ‘

To solve this problem, I just add WSGIPassAuthorization On to /etc/apache2/sites-available/mySite.conf file, as follows:

        ...
                </Files>
        </Directory>

        WSGIPassAuthorization On

        WSGIScriptAlias / /home/X/wsgi.py
        WSGIDaemonProcess sepanta_dev python-path=/home/X python-home=/home/X/venv
        ...
๐Ÿ‘คMohammad Nazari

Leave a comment