重写IIS 7中响应头的规则(替换cookie路径)

重写IIS 7中响应头的规则(替换cookie路径),iis,cookies,url-rewriting,http-headers,reverse-proxy,Iis,Cookies,Url Rewriting,Http Headers,Reverse Proxy,我不得不将我的web应用程序从apache移植到IIS7,并且在正确配置时遇到了麻烦 在apache配置中,我配置了一些mod rewrite东西(为了与apache活动mq通信),如下所示: #Reverse-Proxy to ActiveMQ AJAX-Interface ProxyPass /foo/bar/amq http://localhost:8161/foo/amq/ ProxyPassReverse /foo/bar/amq http://localhost:816

我不得不将我的web应用程序从apache移植到IIS7,并且在正确配置时遇到了麻烦

在apache配置中,我配置了一些mod rewrite东西(为了与apache活动mq通信),如下所示:

#Reverse-Proxy to ActiveMQ AJAX-Interface
ProxyPass        /foo/bar/amq http://localhost:8161/foo/amq/
ProxyPassReverse /foo/bar/amq http://localhost:8161/foo/amq/
ProxyPassReverseCookiePath /foo /
Set-Cookie: JSESSIONID=1lu7hn253csbh11jax27k2i072;Path=/foo
我已尝试使用配置IIS 7。 将/foo/bar替换为localhost地址的请求中的重写规则已经起作用了,但是我在定义用于在响应中设置正确cookie路径的规则时遇到了一些问题

我已经找到了一篇关于操纵响应的文章。 对我来说,使用II7,我只能操作响应的HTTP主体

如何以编辑cookie路径的方式操作响应头

响应标头中的cookie路径如下所示:

#Reverse-Proxy to ActiveMQ AJAX-Interface
ProxyPass        /foo/bar/amq http://localhost:8161/foo/amq/
ProxyPassReverse /foo/bar/amq http://localhost:8161/foo/amq/
ProxyPassReverseCookiePath /foo /
Set-Cookie: JSESSIONID=1lu7hn253csbh11jax27k2i072;Path=/foo
路径应编辑为“路径=/”

谢谢你的时间和帮助 Rolf

这应该可以

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <outboundRules>
                <remove name="Update Cookie Path" />
                <rule name="Update Cookie Path">
                    <match serverVariable="RESPONSE_Set_Cookie" pattern="^(.*; path=/)foo$" />
                    <conditions />
                    <action type="Rewrite" value="{R:1}" />
                </rule>
            </outboundRules>
        </rewrite>
    </system.webServer>
</configuration>


.

Thx很多!!!它几乎没有修改就工作了,你刚刚救了我一周;)但是RESPONSE\u SET\u COOKIE实际上是RESPONSE\u SET\u COOKIE。问候-罗尔夫