I have a local website on ASP.NET. And I need to proxy some of the static content (from folder "static") to another website.
I've added this rule:
<rule name="All in static folder" stopProcessing="true">
<match url="^static/.*" />
<action type="Rewrite" url="http://otherwebsite.com/{R:0}" appendQueryString="true" logRewrittenUrl="true" />
</rule>
But that doesn't work - based on failed request log my route matches (PATTERN_MATCH step has Matched "true", then I see correct url in REWRITE_ACTION and RULE_EVALUATION_END) but I see that ASP.NET continue to evaluate other modules after this and so trying to serve the content by itself, hitting the static file handler and getting 404 (because there are not such files on the disk).
I do have access to the rewritten file (files like http://otherwebSite.com/static/stylesheet.css opened in browser without any problem). Also writing some other alias (in etc/hosts) and opening http://otherwebSiteLocalAlias.com/static/stylesheet.css also works (meaning that website does not have some host/proxy verification mechanism).
Changing action to "redirect" also works but it's not acceptable in my case.
I have another rule that proxifying a non static resource (folder url like /mypage/) to the same host and it works. It's just does not work with static files - it seems like after url rewrite done it's job properly the request continue to be handled by asp.net which shouldn't be the case.