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 HTTP 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
In the web site pane, double-click HTTP Response Headers in the IIS section. In the actions pane, select Add. In the Name box, type the custom HTTP header name. In the Value box, type the custom HTTP header value.
First, open your IIS Manager and click on Default Web Site at the left panel. Double-click on the URL Rewrite module, as shown below, to add rewrite rules. 2. Next, click on Add Rule(s) option at the right panel, and a pop-up window appears where you'll select a rule template.
When done on the server level it is saved in the ApplicationHost. config file. You can also define it on the folder level, it that case it is saved in a web. config file inside that folder.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With