我在哪里放“WSGIPassAuthorization On”?

时间:2021-02-11 12:22:41

I'm trying to see the Authorization header in Django, using mod_wsgi. I read that Apache holds back the Authorization header by default, I've put << WSGIPassAuthorization On >> in my Apache VirtualHost block and . . . nada.

我正在尝试使用mod_wsgi查看Django中的Authorization标头。我读到Apache默认保留了Authorization标头,我在我的Apache VirtualHost块中放了<< WSGIPassAuthorization On >>。 。 。缥缈。

How do I figure out where to put this?

我怎么知道把它放在哪里?

2 个解决方案

#1


17  

Put it at same place as WSGIScriptAlias and it should work fine.

把它放在与WSGIScriptAlias相同的地方,它应该可以正常工作。

#2


0  

Connect to your EC2, go to etc/httpd/conf.d folder and open wsgi.conf file. Insert the code within VirtualHost DOM:

连接到EC2,转到etc / httpd / conf.d文件夹并打开wsgi.conf文件。在VirtualHost DOM中插入代码:

WSGIPassAuthorization On

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

#1


17  

Put it at same place as WSGIScriptAlias and it should work fine.

把它放在与WSGIScriptAlias相同的地方,它应该可以正常工作。

#2


0  

Connect to your EC2, go to etc/httpd/conf.d folder and open wsgi.conf file. Insert the code within VirtualHost DOM:

连接到EC2,转到etc / httpd / conf.d文件夹并打开wsgi.conf文件。在VirtualHost DOM中插入代码:

WSGIPassAuthorization On

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