开发者

Rewrite rules for response headers in IIS 7 (replacing the cookie path)

I have to port my web application from apache to IIS 7 and got into trouble with the proper configuration.

In the apache configuration, I configured some mod rewrite stuff (in order to communicate with an apache active mq) like this:

#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 /

I've tried to configure the IIS 7 by using ApplicationRequestRouting. The rewrite rule in the request for replacing the /foo/bar to the localhost adress does already work, but I've some problems to define a rule for setting up the correct cookie path in the response.

I've already found an article about manipulating responses here. For me, it looks like with II7 I can only manipulate the H开发者_C百科TTP body of the response.

How can I manipulate the response header in a way to edit the cookie path?

The cookie path in the response header looks like this:

Set-Cookie: JSESSIONID=1lu7hn253csbh11jax27k2i072;Path=/foo

The Path should be edited to "Path=/".

Thank for your time and your help Rolf


This should do it

<?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>

Check the more detailed reference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜