I'm running a ReactJS front end with an ASP Net core backend for API calls on my IIS server. There is only one URL and I believe it's set to port 443 via NetScaler (I have no control over the URL/NetScaler).
My ReactJS is on port 443. My ASP Net Core is on port 444 (I'm not sure if this is right or not). I'm aiming for all calls that have /fsapi/ in the path to go to the backend.
Currently I have the following rules:
<rules>
<clear />
<rule name="Flag Status API calls" stopProcessing="true">
<match url="fsapi/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{PATH_INFO}" pattern="fsapi/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)" />
</conditions>
<action type="Rewrite" url="localhost:444/{R:1}/{R:2}" appendQueryString="false" logRewrittenUrl="true" />
</rule>
<rule name="React routing">
<match url="fsapi/([0-9a-zA-Z]+)" negate="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_METHOD}" pattern="^GET$" />
<add input="{HTTP_ACCEPT}" pattern="^text/html" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="/" appendQueryString="false" />
</rule>
</rules>
One rule is to make the React Routing work while the other is attempt to redirect the api calls.
As it is currently the React Routing rule works great, but any API calls get a 502.
I'm not sure if I'm barking up the wrong tree with attempting to do it this way, but from what guides I've seen this seems to be the way.