Skip to content

Commit 26a28e6

Browse files
update with caching info
1 parent 467061b commit 26a28e6

File tree

1 file changed

+61
-42
lines changed

1 file changed

+61
-42
lines changed

articles/static-web-apps/front-door-manual.md

Lines changed: 61 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: static-web-apps
55
author: craigshoemaker
66
ms.service: static-web-apps
77
ms.topic: how-to
8-
ms.date: 09/20/2021
8+
ms.date: 01/07/2022
99
ms.author: cshoe
1010
---
1111

@@ -17,11 +17,11 @@ In this tutorial, you learn how to:
1717

1818
> [!div class="checklist"]
1919
>
20-
> - Create an Azure Front Door instance
20+
> - Create an Azure Front Door Standard/Premium instance
2121
> - Associate Azure Front Door with your Azure Static Web Apps site
2222
2323
> [!NOTE]
24-
> This tutorial requires the Azure Static Web Apps Standard plan.
24+
> This tutorial requires the Azure Static Web Apps Standard and Azure Front Door Standard / Premium plans.
2525
2626
## Copy URL
2727

@@ -39,76 +39,88 @@ In this tutorial, you learn how to:
3939

4040
1. Select **Create a resource**.
4141

42-
1. Search for **Azure Front Door**.
42+
1. Search for **Front Door**.
4343

44-
1. Select **Front Door**.
44+
1. Select **Front Door Standard/Premium**.
4545

46-
Make sure not to select the service labeled *Front Door Standard/Premium* as the steps for the Standard/Premium service differ from what's presented in this tutorial.
46+
Make sure to select the service labeled *Front Door Standard/Premium*.
4747

4848
1. Select **Create**.
4949

50+
1. Select **Azure Front Door Standard/Premium (Preview)**.
51+
52+
1. Select **Quick create**.
53+
54+
1. Select **Continue to create a front door**.
55+
5056
1. In the *Basics* tab, enter the following values:
5157

5258
| Setting | Value |
5359
|---|---|
5460
| Subscription | Select your Azure subscription. |
5561
| Resource group | Enter a resource group name. This name is often the same group name used by your static web app. |
5662
| Resource group location | If you create a new resource group, enter the location nearest you. |
63+
| Name | Enter **my-static-web-app-front-door**. |
64+
| Tier | Select **Standard**. |
65+
| Endpoint name | Enter a unique name for your Front Door host. |
66+
| Origin type | Select **Custom**. |
67+
| Origin host name | Enter the hostname of your static web app. Make sure your value does not include a trailing slash or protocol. (For example, `desert-rain-04056.azurestaticapps.net`) |
68+
| Caching | Check the *Enable caching* checkbox. |
69+
| Query string caching behavior | Select **Use Query string** from the dropdown. |
5770

58-
Select **Next: Configuration >**.
71+
1. Select **Review + create**.
5972

60-
1. In the *Configuration* tab, select the **plus sign** next to *Frontends/domains*, and enter the following value:
73+
1. Select **Create**.
6174

62-
| Setting | Value |
63-
|---|---|
64-
| Host name | Enter a unique name for your Front Door host. |
75+
The creation process may take a few minutes to complete.
6576

66-
Accept the defaults for the rest of the form, and select **Add**.
77+
1. Select **Go to resource**.
6778

68-
1. Select the **plus sign** next to *Backend pools*, and enter the following value:
79+
## Disable cache for auth workflow
6980

70-
| Setting | Value |
71-
|---|---|
72-
| Name | Enter **my-static-web-app-pool**. |
81+
Add the following settings to disable Front Door's caching policies from trying to cache authentication and authorization related pages.
7382

74-
1. Select **+ Add a backend**, and enter the following values:
83+
1. Under *Settings*, select **Rule set**.
7584

76-
| Setting | Value |
77-
|---|---|
78-
| Backend host type | Select **Custom host**. |
79-
| Backend host name | Enter the hostname of your static web app. Make sure your value does not include a trailing slash or protocol. (For example, `desert-rain-04056.azurestaticapps.net`) |
80-
| Backend host header | Enter the hostname of your static web app. Make sure your value does not include a trailing slash protocol. (For example, `desert-rain-04056.azurestaticapps.net`) |
85+
1. Select **Add**.
8186

82-
Accept the defaults for the rest of the form, and select **Add**.
87+
1. In the *Rule set name* textbox, enter **Security**.
8388

84-
1. Select **Add**.
89+
1. In the *Rule name* textbox, enter **NoCacheAuthRequests**.
8590

86-
1. Select the **plus sign** next to *Routing rule*, and enter the following value:
91+
1. Select **Add a condition**.
8792

88-
| Setting | Value |
89-
|---|---|
90-
| Name | Enter **my-routing-rule**. |
93+
1. Select **Request path**.
9194

92-
Accept the defaults for the rest of the form, and select **Add**.
95+
1. Select **Begins With** in the *Operator* drop down.
9396

94-
1. Select **Review + create**.
97+
1. Select the **Edit** link above the *Value* textbox.
9598

96-
1. Select **Create**.
99+
1. Enter **/.auth** in the value textbox.
97100

98-
The creation process may take a few minutes to complete.
101+
1. Select **Add an action**.
99102

100-
1. Select **Go to resource**.
103+
1. Select **Cache expiration**.
101104

102-
1. Select **Overview**.
105+
1. Select **Bypass cache** in the *Cache Behavior* dropdown.
103106

104-
1. Select the link labeled *Frontend host*.
107+
1. Select **Save**.
105108

106-
When you select this link, you may see a 404 error if the site is not fully propagated. Instead of refreshing the page, wait a few minutes and return back to the *Overview* window and select the link labeled *Frontend host*.
109+
1. Select the **Unassociated** link.
107110

108-
1. From the *Overview* window, copy the value labeled **Front Door ID** and paste it into a file for later use.
111+
1. Select the Endpoint name you want to apply this rule.
109112

110-
> [!IMPORTANT]
111-
> By default, Azure Front Door configures [health probes](../frontdoor/front-door-health-probes.md) that may affect your traffic statistics. You may want to edit the default values for the [health probes](../frontdoor/front-door-health-probes.md).
113+
1. Select **Next**.
114+
115+
1. Select **Associate**.
116+
117+
## Copy Front Door ID
118+
119+
Use the following steps to copy the Front Door instance's unique identifier.
120+
121+
1. Select **Overview**.
122+
123+
1. From the *Overview* window, copy the value labeled **Front Door ID** and paste it into a file for later use.
112124

113125
## Update static web app configuration
114126

@@ -149,10 +161,17 @@ Open the [staticwebapp.config.json](configuration.md) file for your site and mak
149161

150162
With this configuration, your site is no longer available via the generated `*.azurestaticapps.net` hostname, but exclusively through the hostnames configured in your Front Door instance.
151163

152-
> [!NOTE]
153-
> When you deploy updates to existing files in your static web app, Azure Front Door may continue to serve older versions of your files until their [time-to-live](https://wikipedia.org/wiki/Time_to_live) expires. [Purge the Azure Front Door cache](../frontdoor/front-door-caching.md#cache-purge) for the affected paths to ensure the latest files are served.
164+
## Considerations
165+
166+
- **Custom domains**: Now that Front Door is managing your site, you no long use the Azure Static Web Apps custom domain feature. Azure Front Door has a separate process for adding a custom domain. Refer to [Add a custom domain to your Front Door](../frontdoor/front-door-custom-domain.md). When you add a custom domain to Front Door, you'll need to update your static web app configuration file to include it in the `allowedForwardedHosts` list.
167+
168+
- **Traffic statistics**: By default, Azure Front Door configures [health probes](../frontdoor/front-door-health-probes.md) that may affect your traffic statistics. You may want to edit the default values for the [health probes](../frontdoor/front-door-health-probes.md).
169+
170+
- **Serving old versions**: When you deploy updates to existing files in your static web app, Azure Front Door may continue to serve older versions of your files until their [time-to-live](https://wikipedia.org/wiki/Time_to_live) expires. [Purge the Azure Front Door cache](../frontdoor/front-door-caching.md#cache-purge) for the affected paths to ensure the latest files are served.
171+
172+
## Clean up resources
154173

155-
Now that Front Door is managing your site, you no long use the Azure Static Web Apps custom domain feature. Azure Front Door has a separate process for adding a custom domain. Refer to [Add a custom domain to your Front Door](../frontdoor/front-door-custom-domain.md). When you add a custom domain to Front Door, you'll need to update your static web app configuration file to include it in the `allowedForwardedHosts` list.
174+
If you no longer want to use the resources created in this tutorial, delete the Azure Static Web Apps and Azure Front Door instances.
156175

157176
## Next steps
158177

0 commit comments

Comments
 (0)