I am currently stuck with my rewrite rules, and I would need some hints about it.
Here's the situation : We have two websites, one is website.com, the other one is website-staging.com (just examples here ofc)
On website.com, for some url, I'd like to use a rewrite rule to hit the staging website and display the results.
Here's the rule in the web.config file :
<rule name="RewriteSearchQueries" patternSyntax="Wildcard" stopProcessing="true">
<match url="search?*" />
<action type="Rewrite" url="https://website-staging.com/{R:0}" logRewrittenUrl="true" />
I did the pattern test, everything's ok. The URL used for the rewrite is working properly, however when I hit website-staging.com/search?arg=1&blabla=2, I have a 404 error message :
404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
I did try to put the following action as well :
<action type="Rewrite" url="https://website-staging.com/search?{R:1}" logRewrittenUrl="true" />
And it didn't work either. Any clue ?
EDIT : Application Request Routing is installed, the proxy is enabled.
So.. After installing FRT as advised by Lex Li, I saw that there was no match, therefore no URL rewriting was done.
I did test again and again the pattern, everything was fine.
Finally, I decided to replace the wildcard by regex, and.. Tadam ! It worked. For a reason that I can't explain, the wildcard pattern wasn't detected properly, despite being OK with the pattern tester, while using regex did the trick perfectly.
So, if you're facing a similar issue, regex all the way !