Tyler Durden
Tyler Durden

Reputation: 1036

IIS Url Rewriter rewrite fails but redirect works flawlessly

I have to set up a couple of apps on a new intranet server (Win 2008 R2 Standard SP1). I have been having some difficulty with a URL Rewriter rule. I had a similar rule working great on my local IIS (Win 7). The rule is designed to create a reverse proxy for a web service that enables jQuery AJAX requests from the client to avoid XSS.

The rule is as below and if I use this as is, and type an example URL into the browser:

http://srv01.domain.com/serviceproxy/workflow/Users/GetUsers?q=smith&max=10

I get a 404 response from the server. If I change the type to "Redirect" I get the response from the server expected (but obviously this will void my attempt to avoid XSS).

<rewrite>
  <rules>
    <rule name="Reverse Proxy - WCF Service" stopProcessing="true">
      <match url="serviceproxy/workflow/(.+)" />
      <action type="Rewrite" url="http://srv01.domain.com/WorkflowService/{R:1}" />
    </rule>
  </rules>
</rewrite>

Any ideas what might be missing from the server configuration? Is it a security setting somewhere that needs to be configured to allow the rewrite to occur?

Upvotes: 4

Views: 2210

Answers (2)

Ismael
Ismael

Reputation: 999

Had a similar issue on Windows 2008, IIS 7.5 The problem was that the app pool was in integrated mode. that caused issues with the rewrite. Redirect was always ok, but rewrite always failed.

changed the app pool to classic mode and problem solved (at least for now).

a better solution might be http://forums.iis.net/t/1200671.aspx?ARR+URl+Rewrite+is+not+working+for+external+servers right at the end. but i havent tried it.

Upvotes: 1

Tyler Durden
Tyler Durden

Reputation: 1036

I found my issue. I didn't have Application Request Routing installed on this server. Either I forgot installing it on my other server or it was already on there for another reason.

Found this article that helped me resolve it.

http://www.iis.net/learn/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing

Upvotes: 2

Related Questions