Skip to main content
 首页 » 编程设计

php之在 Python 中获取 HTTP header

2025年05月04日19mate10pro

我已经将 OpenAm 设置为我的 python 服务器的身份验证模块。在我的 python 服务器前面是作为反向代理工作的 Apache http 服务器。 OPenAM 代理安装在 Apache http 服务器上。每次调用Apache http服务器首先重定向到OpenAm服务器进行鉴权,OpenAm鉴权后会将http head中的一些用户属性转发给Apache服务器。使用 php 代码,我可以轻松地从 header 中转储内容。所以我的问题是:有什么方法可以从我的 python 服务器的 http head 中检索这些信息?

请您参考如下方法:

http://modpython.org/live/mod_python-3.3.1/doc-html/pyapi-mprequest-mem.html

headers_in

当然,您必须配置代理以注入(inject)所需的 header ,请参阅我对 openam 别名的回复。