使用 Python、Apache 和 mod_wsgi 进行身份验证
上周我一直在积极寻找,希望找到解决我的问题的方法。最初,我在 Windows、Apache、MySQL 和 Python 服务器上使用 CGI 配置了 Python。我知道 CGI 很慢,并且在执行 Python 环境之前还会删除 HTTP_AUTHORIZATION 标头。我已经配置了 mod_wsgi 并将以下内容添加到我的 httpd.conf 中:
WSGIScriptAlias /flex/entry "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/flex/entry.wsgi"
WSGIPassAuthorization On
我的理解是 HTTP_AUTHORIZATION 现在通常可以通过 os.environ['HTTP_AUTHORIZATION']
在 Python 中访问。然而,事实并非如此。
有人可以解释一下我错过了什么/做错了什么吗?
谢谢! 特伦特
I have been searching vigorously the last week in hopes of finding a solution to my problem. Originally, I had Python configured with CGI on my Windows, Apache, MySQL, and Python server. I understand that CGI is slow and additionally drops HTTP_AUTHORIZATION headers before executing the Python environment. I have since configured mod_wsgi and added the following to my httpd.conf:
WSGIScriptAlias /flex/entry "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/flex/entry.wsgi"
WSGIPassAuthorization On
My understanding is that HTTP_AUTHORIZATION would normally now be accessible in Python via os.environ['HTTP_AUTHORIZATION']
. However, this is not the case.
Can someone please explain what I am missing/doing wrong?
Thanks!
Trent
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它作为
environ
传递到主 WSGI 函数的映射中。It's passed in the mapping passed as
environ
to the main WSGI function.