I have the world's simplest regular expression: *
I put it in a web site in IIS because I want one of the sites to be a proxy, and the others to serve locally. So, the web.config is:
<system.webServer>
<rewrite>
<rules>
<rule name="AllRewrite" stopProcessing="true">
<match url="*" />
<action type="Rewrite" url="http://tom-pc/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
However, that throws this error:
The expression "" contains a repeat expression (one of '', '?', '+', '{' in most contexts) that is not preceded by an expression.
Any ideas?
The error says it all. Your regular expression is invalid. The * is a repeat character (zero or more times). You should indicate which character is allowed to be repeated zero or more times. You probably want any character, so your regular expression should be: .*
<match url=".*" />
To answer your other question about proxying, it's not possible to proxy by rewriting to another host name. You can only rewrite to other URI's on the same server. To proxy with IIS you have to install the ARR (Application Request Routing) module.
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