IIS Rewrite CGI Error 404

Marcio Abreu 1 Reputation point
2022-08-06T21:11:25.327+00:00

on my IIS web.conf I have the following rule

<rule name="Rule1" enabled="true" stopProcessing="true">
<match url="mypath/(.*)" />
<serverVariables>
<set name="HTTP_X_FORWARDED_HOST" value="{HTTP_HOST}:{SERVER_PORT}" />
<set name="HTTP_REFERER" value="" />
<set name="HTTP_ORIGIN" value="" />
</serverVariables>
<action type="Rewrite" url="http://HOST_LAN_IP:8007/{R:1}" />
</rule>

when going to the page https://subdomain.domain.com/mypath, there are many errors was follows:

Loading failed for the <script> with source “https://subdom.domain.com/mypath/webapi/entry.cgi?api=SYNO.Core.Desktop.SessionData&version=1&method=getjs&launchApp=SYNO.SDS.AudioStation.Application&SynoToken=&v=1647950553”.

All content failing to load are cgi files and it is referred on the original page as
<script type="text/javascript" src="webapi/entry.cgi?api=SYNO.Core.Desktop.SessionData&version=1&method=getjs&launchApp=SYNO.SDS.AudioStation.Application&SynoToken=&v=1647950553"></script>

My guess is that IIS somehow is not properly handling the text/javascript type cgi, but I don't know if that is the case, and if so how to fix it!

Internet Information Services
{count} votes

1 answer

Sort by: Most helpful
  1. Marcio Abreu 1 Reputation point
    2022-08-08T03:15:35.16+00:00

    It’s not the browser, but the IIS rule is not keeping the proper routing for grabbing the content… it returned 302 followed by 404 when I traced the headers… (Web Developer mode in Network/ responses)
    What variables should I use for preserving the proper address during the traffic of data between the proxy and the backend server?