无法在网络服务器上设置响应头

时间:2018-12-06 11:58:39

标签: regex apache webserver iplanet

在Web服务器下,我具有以下配置来设置HTML页面的响应标头。当我们从浏览器访问页面时,说www.mysite.com/en/myfile.xml

由于要重写规则,它以/en/myfile.xml.html的形式映射到服务器,并且在浏览器的“网络”标签中看到了XML格式的响应。但是在“标题”部分中,此请求的响应类型为“ text / html”而不是“ text / xml”。因此,我无法获得内容的XML视图。

<If $uri =~ '(.*)\myfile.xml.html$'>
            NameTrans fn="set-variable" insert-srvhdrs="Content-type: text/xml;charset=UTF-8"
</If>
<ElseIf $uri =~ "^/...*/$" or $uri =~ '(.*)\.html$'>
        NameTrans fn="set-variable" insert-srvhdrs="Content-type: text/html;charset=UTF-8"
        NameTrans fn="set-variable" insert-srvhdrs="Vary: Accept-Encoding"
</ElseIf>

您能提供一种解决方法吗?

谢谢

0 个答案:

没有答案
相关问题