React Web Application: You do not have permission to view this directory or page

Jyotiraditya Dhalmahapatra 6 Reputation points
2022-05-30T10:03:36.667+00:00

Hi,

We are working on React Web Application, And We are using Azure Web App Service to deploy the React app for UAT and Production. To deploy into Azure App Service, We are using Azure DevOps process to deploy the application to Azure App Service.

We are successfully able to deploy via Azure DevOps channel, but after deployment when I am trying to hit

{YourAppServiceName}.azurewebsites.net, I am getting error saying You don't have access/permission to view this directory or page.

We did someR&D and came to know that Azure App Service uses IIS to host application internally, we then required to add web.config so that it can overwrite the react-router-dom, But after adding web.config file and re-publish again I am getting the same error.

I need someone's help/guidance here that I am not able to understand what is the problem/issue while deploying?

Thanks in Advance.

Best regards.
Jyotiraditya

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,938 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2022-05-31T08:38:25.81+00:00

    Thanks for reaching here! Could you please confirm if you have configured default document. The default document is the web page that is displayed at the root URL for a website. As this happens if there is no default page in your Azure website.

    You can try to directly view the page with following URL: https://{siteanme}.azurewebsites.net/views/login.html

    Or you could add the default document in the project root folder and set it as default page in App setting on the Azure portal and save the setting.

    206949-defaultdocument-word.png

    Also suggest you to check the IP restrictions or authentication settings on the Azure web application that may block you.

    Check Web App > Authentication /Authorization and Web App > Networking > Access Restrictions.

    Further you may refer to Deploying create-react-app on Microsoft Azure

    1. Create the production build by executing 'npm run build' command. A build folder will be generated in the solution with some meta data files.
    2. Reference the build folder while deploying the react app to azure.

    Let us know.

    2 people found this answer helpful.
    0 comments No comments

  2. Surbhi 596 Reputation points Microsoft Employee
    2022-07-22T07:03:44.587+00:00

    Thank you so much @SnehaAgrawal-MSFT , your guidance on above query helped me as well. Thank you.

    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.