Home > Mobile >  Refresh takes me to a 404
Refresh takes me to a 404

Time:02-16

Can anyone help me? I deployed the App Service in Azure Portal but the page refresh takes me to a 404 error. I adjusted the Nginx configs but they are overwritten over time. What am I doing wrong?

CodePudding user response:

App Service Always On generate periodic (every 5min) probes to app instances and causing failed requests with error 404, and this can be found in Application Insights as below:

enter image description here

This can be fixed by rewriting the Always on path.

After a cold start of your application, AlwaysOn will send a request to the ROOT of your application “/”.

Whatever file is delivered when a request is made to / is the one which will be warmed up, which will fail because the root doesn’t exist.

If you wanted AlwaysOn to warmup a specific page instead of the root, then you can implement this URL Rewrite rule.

<?xml version="1.0" encoding="UTF-8" standalone="no">
<configuration>
    <system.webServer>
      <rewrite>
        <rules>
          <rule name="Rewrite AlwaysOn" stopProcessing="true">
            <match url="^$" />
            <conditions>
              <add input="{HTTP_USER_AGENT}" pattern="^AlwaysOn$" />
            </conditions>
            <action type="Rewrite" url="/api/Online/Ping" />
          </rule>
        </rules>
      </rewrite>
    </system.webServer>
</configuration>
  • Related