How to fix Fallback routes not working even after adding web.config file in Azure App Service after deployment

Sridhar, Kailash 0 Reputation points
2023-07-18T11:10:42.58+00:00

How to fix Fallback routes not working even after adding web.config file in Azure App Service after deployment,

web.config file

<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="React Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,971 questions
{count} votes

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 17,741 Reputation points Microsoft Employee Moderator
    2023-07-19T21:53:17.52+00:00

    @Sridhar, Kailash Sharing the answer here directly from the post that @Anonymous shared above.

    "you are configuring IIS re-write rules. as linux based app services do not use IIS, they have no effect (in fact web.config is ignored).

    typically with linux, you would use ngnix to perform this feature.

    https://www.nginx.com/blog/securing-applications-microsoft-azure-app-service-nginx-plus/"

    source: https://learn.microsoft.com/en-us/answers/questions/910710/set-up-url-rewrite-for-linux-based-azure-app-servi?ssp=1&darkschemeovr=1&setlang=en-CA&safesearch=moderate

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.