Skip to content

Commit 4a9b0f5

Browse files
committed
configure error pages
1 parent 715a988 commit 4a9b0f5

File tree

3 files changed

+58
-2
lines changed

3 files changed

+58
-2
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Configure error pages on App Service
3+
description: Learn how to configure a custom error page on App Service
4+
author: jefmarti
5+
ms.topic: how-to
6+
ms.custom: linux-related-content
7+
ms.date: 10/14/2024
8+
ms.author: jefmarti
9+
---
10+
11+
# Configure error pages on App Service (preview)
12+
13+
This article explains how to configure custom error pages on your web app. You can configure an error page for specific errors that will be presented to users instead of the default error page.
14+
15+
### Prerequisite
16+
In this tutorial, we'll be adding a custom 403 error page to our web app hosted on App Service and test it with an IP restriction. To do so, you'll need the following:
17+
- a web app hosted on App Service w/ a Premium SKU
18+
- an html file under 10kb in size
19+
20+
## Upload an error page
21+
For this example, we are uploading and testing a 403 error page to present to the user. Name your html file to match the error code (e.g. `403.hmtl`). Once you have your html file prepared you can upload it to your web app. In the configuration blade, you should see an **Error pages (preview)** tab. Click on this tab to view the error page options. If the options are greyed out, you'll need to upgrade to at least a Premium SKU to use this feature.
22+
23+
Select the error code that you'd like to upload an error page for and click **Edit**. On the next screen, click the folder icon to select your html file. The file must be in html format and within the 10kb size limit. Find your .html file and click on the **Upload** button at the bottom of the screen. You'll notice the Status in the table will update from Not Configured to Configured. Then click **Save** to complete the upload.
24+
25+
## Confirm error page
26+
Once the custom error page is uploaded and saved, we can trigger and view the page. In this example, we can trigger the 403 error by using an IP restriction.
27+
28+
To set an IP restriction, go to the **Networking** blade and click the **Enabled with access restrictions** link under **Inbound traffic configuration**.
29+
30+
Under the **Site access and rules** section, select the **+Add** button to create an IP restriction.
31+
32+
In the form that follows, you'll need to change the Action to **Deny** and fill out the **Priority** and **IP Address Block**. In this example, we use the **Inbound address** found on the Networking blade and we're setting it to /0 (e.g. `12.123.12.123/0`). This will disable all public access when visiting the site.
33+
34+
Once the Add rule form is filled out, select the **Add rule** button. Then click **Save**.
35+
36+
Once saved, you'll need to restart the site for the changes to take affect. Go to your overview page and select **browse**. You should now see your custom error page load.
37+
38+
## Error codes
39+
App Service currently supports 3 types of error codes that are available to customize:
40+
41+
| Error code | description |
42+
| ------------- | ------------- |
43+
| 403 | Access restrictions |
44+
| 502 | Gateway errors |
45+
| 503 | Service unavailable |
46+
47+
## FAQ
48+
1. I've uploaded my error page, why doesn't it show when the error is triggered?
49+
50+
Currently, error pages are only triggered when the error is coming from the front end. Errors that get triggered at the app level should still be handled through the app.
51+
52+
2. Why is the error page feature greyed out?
53+
54+
Error pages is currently a Premium feature. You need to use at least a Premium SKU to enable the feature.

articles/app-service/includes/deploy-intelligent-apps/deploy-intelligent-apps-linux-dotnet-pivot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ var kernel = builder.Build();
190190

191191
### Secure your app with managed identity
192192

193-
If youre using Azure OpenAI, it's highly recommended to secure your application using [managed identity](../../overview-managed-identity.md) to authenticate your app to your Azure OpenAI resource. This enables your application to access the Azure OpenAI resource without needing to manage API keys. If you're not using Azure OpenAI, your secrets can remain secure using Azure Key Vault outlined above.
193+
If you're using Azure OpenAI, it's highly recommended to secure your application using [managed identity](../../overview-managed-identity.md) to authenticate your app to your Azure OpenAI resource. This enables your application to access the Azure OpenAI resource without needing to manage API keys. If you're not using Azure OpenAI, your secrets can remain secure using Azure Key Vault outlined above.
194194

195195
Follow the steps below to secure your application with managed identity:
196196

articles/app-service/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
- name: Use settings from App Configuration
4242
href: app-service-configuration-references.md
4343
- name: App settings reference
44-
href: reference-app-settings.md
44+
href: reference-app-settings.md
45+
- name: Configure error pages
46+
href: configure-error-pages.md
4547
- name: Configure specific languages
4648
items:
4749
- name: Configure ASP.NET

0 commit comments

Comments
 (0)