mod_proxy_html和Apache 2.2.29:解析所有<meta http-equiv =“”content =“”/>并将它们转换为真正的http标头

时间:2015-10-17 15:14:40

标签: apache http header mod-proxy-html http-equiv

我在Mac OS X Yosemite 10.10上使用Mamp 3(专业版);我已经编译并安装了mod_proxy_html(3.1.2)和mod_xml2enc,Apache 2.2.29正确加载它们没有问题。

这是我典型的html文件:

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Authorization" content="Bearer dummyToken">
    <title>Header Test</title>
</head>
<body>

</body>

我需要将所有<meta http-equiv="some" content="thing">转换为真正的http标头。我已经知道如何通过ajax做到这一点,这不是问题。但我需要在授权标头字段中添加一个oauth令牌,以便访问各种受保护的资源,如图像或视频流,这些资源不通过ajax提供,而是通过url直接引用在html里面。

所以,直接在我的httpd.conf中我有:

ProxyHTMLEnable On
ProxyHTMLMeta On

此配置应全局适用于apache 。目前,我的服务器回复了请求中包含的所有字段:似乎 ProxyHTMLMeta On被忽略,并且所有元标记都没有转换为http标头:

Accept: "*/*"
Accept-Encoding: "identity;q=1, *;q=0"
Accept-Language: "it,en;q=0.8"
Connection: "keep-alive"
Cookie: "laravel_session=dummy
DNT: "1"
Host: "192.168.2.2:8888"
Range: "bytes=0-"
User-Agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2535.0 Safari/537.36"

请参阅,授权标头。如果我从SoapUI调用api:

"Accept-Encoding": "gzip,deflate",
"Authorization": "Bearer dummy",
"Host": "fillusso:8888",
"Connection": "Keep-Alive",
"User-Agent": "Apache-HttpClient/4.1.1 (java 1.5)"

这是一种魔术,标题就在那里(因为它直接从SoapUI发送,这里没有解析或元标记)。

我该如何解决这个问题?我做的一切都好吗?

0 个答案:

没有答案