使用mod_substitute在httpd中的html响应中替换head部分

问题描述

我想使用mod_substitute替换html响应中的

。我正在使用httpd 2.2将代理请求向下还原到应用程序服务器(weblogic)。

httpd.conf中的代理定义/映射如下。 我正在加载mod_substitute.so,mod_filter.so和mod_wl_22.so

localhost:8080/{path}

我需要在html响应中的

替换为 ,访问应用程序后,类似下面的内容
<Location /test>
    SetHandler weblogic-handler
    WebLogiccluster a.b.c.d:8080
    Order allow,deny
    Allow from all
</Location>

<Location "/">
    SetoutputFilter INFLATE;SUBSTITUTE;DEFLATE
    AddOutputFilterByType SUBSTITUTE text/html
    AddOutputFilterByType SUBSTITUTE text/html
    AddOutputFilterByType SUBSTITUTE text/css
    AddOutputFilterByType SUBSTITUTE text/javascript
    AddOutputFilterByType SUBSTITUTE text/plain
    AddOutputFilterByType SUBSTITUTE text/xml
    Substitute "s#<head>#<!-- This is a comment --><head>#inq"
</Location>

您可以通过从网络浏览器中“右键单击网页->查看页面功能”来查看html响应。我正在使用谷歌浏览器。

我看到替换仅在访问根URL(http://www.example.net/)时有效,而在通过URL(http://www.example.net/test调用资源时无效。

当使用资源访问URL时,是否有一种方法可以使替换工作。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)