React JS : After react prod build in IIS , React MSAL callback URL is not redirecting to original URL
After deploying react app production build in IIS server, application launched in browser redirecting to MS AAD but stuck in below URL :
Its not returning to original URL and load all the routes.
I have added below entry in package.json:
"homepage": ".",
Using BrowserRouter and also added basename props to match virtual directory app name.
Added also web.config with below contents in public root of website but no luck
<?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>
Any help/pointers will be appreciated. If we remove Azure AD MSAL code all routes works properly. But if we add and app redirects to Azure AD that is where it is getting stucked.
Windows development | Internet Information Services
Microsoft Security | Microsoft Entra | Microsoft Entra ID
A cloud-based identity and access management service for securing user authentication and resource access