IIS 7.5 Unable to rewrite reverse proxy URLs from the default website to two websites

I want users to access my website for intranet testing - http: // mywebsite: 9090 if they type http: // mywebsite / test .

I follow the section - 7. Reverse proxy to another site / server at http://blogs.iis.net/ruslany/archive/2009/04/08/10-url-rewriting-tips-and-tricks.aspx to create a rewrite URL

After checking the "Enable proxy" checkbox located in the application request routing function view in IIS Manager. I have a rule like -

<rule name="Proxy"> <match url="(.*/test)" /> <action type="Rewrite" url="http://{HTTP_HOST}:9090/{R:1}" /> </rule> 

However, this does not work. This does not lead me to http: // mywebsite: 9090 , but prints that http: // mywebsite / test was not found.

Rule changed to check if this is a proxy problem using

 <rule name="Proxy"> <match url="(.*)" /> <action type="Rewrite" url="http://{HTTP_HOST}:9090/{R:1}" /> </rule> 

I see that he can direct me to http: // mywebsite: 9090 when I look at http: // mywebsite .

What happens to my first rule?

Thanks for the help.

+4
source share
1 answer

What you want is the rule:

"^ test (/.*)?$"

Your action may remain unchanged.

With the rule above, you say: “If the first thing after the HTTP_HOST part of the URL (which includes the first slash, ie“ http://mywebsite.com/ ”) is equal to the test, then you create a capture group on to the rest of the URL (if there is one), rewrite the URL to have HTTP_HOST, add port 9090, and then add everything that was in the first capture group (for example, R: 1, regardless of what parens is in the regular expression )

Make sure you uncheck the “Add query string” box when you grab what you need as part of the regular expression and don’t need it.

Credit where it should, I struggled with the solution of this, too, and found what I need here:

http://forums.iis.net/t/1180781.aspx

+6
source

All Articles