Hi, We are trying to setup a reverse proxy on a Windows 2019 server with IIS, ARR 3.0 and URL Rewrite.
We are wanting to take incoming requests from https://beta-services.companyname.com/avatars/*.jpg and pull them from https://beta-services2.companyname.com/avatars/*.jpg. beta-services is external in DMZ and reachable by our customers but beta-services2 is not (it is reachable from the servers hosting beta-services.companyname.com.
We also have other apis running under beta-services.companyname.com like beta-services.companyname.com/api1name, beta-services.companyname.com/api2name, etc. that we dont want to have any change too.
We have enabled ARR proxy and setup the following rules for https://beta-services.companyname.com in the web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)/avatars" />
<conditions>
<add input="{QUERY_STRING}" pattern="/avatars" />
</conditions>
<action type="Rewrite" url="{C:1}://beta-services2.companyname.com/{R:1}" />
</rule>
</rules>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
<match filterByTags="A, Form, Img" pattern="^http(s)?://beta-services2.companyname.com/(.*)" />
<action type="Rewrite" value="http{R:1}://beta-services.companyname.com/{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
</system.webServer>
</configuration>
the images of the rules are as follows
Inbound

In bound Rules

and outbound rules

Requests to https://beta-services.companyname.com/avatars/filename.jpg just throw 404 errors
requests to https://beta-services.companyname.com/api1name throw 500 errors
What am I doing wrong
thanks