Not able to deploy React app in Azure Web App Service(linux)

Pranoday Dingare 6 Reputation points
2022-05-24T16:49:24.943+00:00

Hello team.
I am trying to deploy both client and server of react app on Azure Web App service. I am not using Azure web app for containers. I have built a client and served it using pm2 server which is running on port 8080. And my server is running on port 4000. Now I want to expose port 4000 on which my server is running. To expose it I have set PORT and WEBSITES_PORT variables in application settings. But web app service gives error that container fails to respond to ping request on port 4000.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2022-05-26T13:23:26.287+00:00

    Just to highlight the difference: app settings/variable- PORT (default) vs WEBSITES_PORT (it’s for custom containers)- If you have both, you may remove PORT variable is not necessary, due to automatic port detection. If no port is detected, it defaults to 80.

    1.By default, App Service assumes your custom container is listening on port 80. If your container listens to a different port, as in your case, you need set the WEBSITES_PORT (for customer containers only).

    Only port 80 and 8080 is accessible (exposed ports) -App Service Linux FAQ

    I understand you have mentioned that you're not using Azure web app for containers.

    2.By default, if your container does not respond after 230 seconds, it will time out. (This time out can be increased by with the WEBSITES_CONTAINER_START_TIME_LIMIT app setting.)

    If your container takes a long time, you could add an app setting called WEBSITES_CONTAINER_START_TIME_LIMIT and set it to the number of seconds you would like for us to wait for your container to start (up to a maximum of 1800).

    To do this, from the Azure Portal> Navigate to your WebApp > Under Settings blade > Go to “Configuration” > Add the above app setting with ‘Name’ with 1800 as ‘Value’ .


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.