I am busy trying to create a Virtual Directory for a new React Application. I have setup the virtual path and my pipeline does deploy my react to site\wwwroot\portal
and the virtual path goes to /portal
. That is all working correctly but the issues I am facing is that my react app does not get the content from the \portal directory , it gets it from the parent. So for example:
https://website.azurewebsites.net/static/css/2.f5a801b7.chunk.css
suppose to go to
https://website.azurewebsites.net/portal/static/css/2.f5a801b7.chunk.css
I have added in a basename
to be /portal
And I added in a web.config to the react app with the following code:
<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="portal\/*.*" negate="true" />
</conditions>
<action type="Rewrite" url="/portal/" />
</rule>
</rules>
</rewrite>
</system.webServer>
I also added the following to the parent web.config
<location path="." inheritInChildApplications="false">
But still all my css and js content looks in the parent folder instead of the portal folder. I am using azure app services
UPDATE:
I have tried what is linked in the following but it does not seem to work: How to deploy react to azure virtual directory