How to set a custom Azure 403 page
Asked Answered
G

2

6

Currently when I stop my Azure App Service web application to publish new code, users will see the ugly blue screen: "Error 403 - This web app is stopped."

Is there any way to create a custom page with my company logo and a friendly message like "This website is under maintenance. Please check back again later."

This way customers won't think that the website is experiencing an unplanned outage.

I understand from Azure Feedback Forum that this is not available -- or is it? If not, is there any workaround?

Giovanna answered 4/5, 2018 at 2:36 Comment(0)
C
2

Unfortunately, as the feedback said, azure app service does not support custom 403 page.

If not, is there any workaround?

I think you could use deployment slot to avoid this issue.

To add a slot as the staging environment, when you publish new code to your application, you could swap the environment from production to staging. After publishing, swap them back. Also, you could set Auto scale. For more details, please refer to this article.

This is a similar post, you could refer to it.

Crate answered 4/5, 2018 at 2:55 Comment(1)
Thanks for the suggestion but my Azure App Service plan is not Standard or Premium so I don't think I can use this.Giovanna
O
1

You can have app_offline.htm page on the root of your application on Azure to show a custom page.

Objection answered 4/5, 2018 at 4:57 Comment(4)
Thanks but this doesn't quite work for me. Am I doing something wrong? When I publish my App Service, I have to first stop the web app (otherwise there will be errors when deploying). When I do this, even if I have app_offline.htm in the root, visitors will still get the Azure 403 screen. If I decide to publish without stopping the App Service (which works sometimes -- not sure when/why), then I don't need app_offline.htm.Giovanna
Are you cleaning the folder while deployment? This would remove app_offline.htmObjection
Thanks again. I have no problem removing app_offline.htm. My issue is when I Stop my app in Azure, visitors cannot access any files, including app_offline.htm. I am hoping to be able to Stop the app and still see a custom 403 page.Giovanna
I don't think it is possible yet. Slots is one option. The other thing you can do is to put app_offline.htm, restart the website and then deploy. It would probably release resources such as dll so you won't get deployment errors. Not ideal but worth trying.Objection

© 2022 - 2024 — McMap. All rights reserved.