Enable url routing in an app service however each time it is restarted this setting is removed

Luiggy Israel Cardoza Agurto 20 Reputation points
2023-07-16T04:49:43.87+00:00
A few days ago I activated an app service along with url routing, however every time the app service is restarted it starts with its default configuration. Apparently the app service is restarted without any user action
Windows for business | Windows Server | User experience | PowerShell
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,976 questions
{count} votes

Accepted answer
  1. Limitless Technology 44,776 Reputation points
    2023-07-17T13:41:51.0066667+00:00

    Hello Luiggy,

    Thank you for your question and for reaching out with your question today.

    If you're experiencing a situation where the URL routing setting in your Azure App Service is being reset to its default configuration after each restart, there are a few possible causes and solutions to consider:

    1. Configuration Persistence: By default, App Service configurations, including URL routing settings, should persist across restarts. However, in some cases, configurations may not persist due to factors like scaling, deployment changes, or Azure updates. To ensure configuration persistence, consider using the App Service's configuration backup and restore feature, which allows you to save and apply configurations during deployment or scaling operations.
    2. Deployment/Continuous Integration (CI) Pipeline: If you have an automated deployment or CI pipeline set up for your App Service, the pipeline may be overwriting the URL routing configuration during each deployment. Check your deployment process and ensure that the pipeline isn't explicitly modifying the URL routing settings or resetting the configuration to its default values.
    3. Configuration as Code: If you're using Infrastructure as Code (IaC) tools like Azure Resource Manager (ARM) templates or Azure PowerShell scripts to provision and manage your App Service, review your configuration files to ensure that the URL routing settings are correctly defined and applied during each deployment.
    4. Azure Functions Proxies: If you're using Azure Functions Proxies for URL routing in your App Service, check the configuration of your proxies. Proxies can define custom routing rules and may override or conflict with the App Service's default URL routing settings. Make sure your proxy configuration is properly defined and does not interfere with the desired URL routing behavior.
    5. Azure Portal or API Interaction: If the URL routing configuration is being reset even without any user action, there might be a bug or issue with the Azure Portal or the underlying API. Report the issue to Microsoft Azure Support, providing specific details about the problem and any steps to reproduce it. They can investigate and provide further assistance.

    It's recommended to review your deployment, configuration, and deployment pipeline processes to identify any potential causes for the URL routing setting being reset. If the issue persists after examining these areas, contacting Azure Support will allow them to investigate the issue further and provide guidance tailored to your specific scenario.

    I used AI provided by ChatGPT to formulate part of this response. I have verified that the information is accurate before sharing it with you.

    If the reply was helpful, please don’t forget to upvote or accept as answer.

    Best regards.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Konstantinos Passadis 19,591 Reputation points MVP
    2023-08-03T22:54:07.5+00:00

    Hello @Luiggy Israel Cardoza Agurto !

    Please add this to your startup command

    1. bash -c "sudo cp /home/site/default /etc/nginx/sites-available/default && service nginx restart"

    Tested and works but something is wrong :

    User's image

    User's image

    I hope this helps!

    Kindly mark the answer as Accepted and Upvote in case it helped!

    Regards


  2. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-08-04T16:02:25.48+00:00

    Following-up from your comments, adding to Limitless Technology and Konstantinos Passadis suggestions. Kindly set up a custom startup script and modify the existing NGINX site configuration.

    NGINX Rewrite Rules for Azure App Service Linux PHP 8.x

    Just to highlight, PHP version 8.x uses NGINX as the default configuration file on Azure app services Linux and the default location of this file on server is - /etc/nginx/sites-available/default.

     

    If the issue persists, set WEBSITES_ENABLE_APP_SERVICE_STORAGE to true :: As mentioned in Azure App Service Linux FAQ doc.

    Having mentioned that, please check out the PHP Support Timeline.

    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.