Skip to content

Commit 4b944b3

Browse files
authored
Merge pull request #204235 from johndowns/front-door-best-practices
Add Front Door and WAF best practices
2 parents 862ae98 + 18506fa commit 4b944b3

File tree

5 files changed

+294
-0
lines changed

5 files changed

+294
-0
lines changed

articles/frontdoor/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@
158158
href: front-door-url-redirect.md?pivots=front-door-standard-premium
159159
- name: Private Link
160160
href: private-link.md
161+
- name: Best practices
162+
href: best-practices.md
161163
- name: Classic
162164
items:
163165
- name: Caching

articles/frontdoor/best-practices.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: Azure Front Door - Best practices
3+
description: This page provides information about how to configure Azure Front Door based on Microsoft's best practices.
4+
services: frontdoor
5+
documentationcenter: ''
6+
author: johndowns
7+
ms.service: frontdoor
8+
ms.topic: article
9+
ms.tgt_pltfrm: na
10+
ms.workload: infrastructure-services
11+
ms.date: 07/10/2022
12+
ms.author: jodowns
13+
---
14+
15+
# Best practices for Front Door
16+
17+
This article summarizes best practices for using Azure Front Door.
18+
19+
## General best practices
20+
21+
### Avoid combining Traffic Manager and Front Door
22+
23+
For most solutions, you should use *either* Front Door *or* [Azure Traffic Manager](/azure/traffic-manager/traffic-manager-overview).
24+
25+
Traffic Manager is a DNS-based load balancer. It sends traffic directly to your origin's endpoints. In contrast, Front Door terminates connections at points of presence (PoPs) near to the client and establishes separate long-lived connections to the origins. The products work differently and are intended for different use cases.
26+
27+
If you combine both Front Door and Traffic Manager together, it's unlikely that you'll increase the resiliency or performance of your solution. Also, if you have health probes configured on both services, you might accidentally overload your servers with the volume of health probe traffic.
28+
29+
If you need content caching and delivery (CDN), TLS termination, advanced routing capabilities, or a web application firewall (WAF), consider using Front Door. For simple global load balancing with direct connections from your client to your endpoints, consider using Traffic Manager. For more information about selecting a load balancing option, see [Load-balancing options](/azure/architecture/guide/technology-choices/load-balancing-overview).
30+
31+
### Use the latest API version and SDK version
32+
33+
When you work with Front Door by using APIs, ARM templates, Bicep, or Azure SDKs, it's important to use the latest available API or SDK version. API and SDK updates occur when new functionality is available, and also contain important security patches and bug fixes.
34+
35+
## TLS best practices
36+
37+
### Use end-to-end TLS
38+
39+
Front Door terminates TCP and TLS connections from clients. It then establishes new connections from each point of presence (PoP) to the origin. It's a good practice to secure each of these connections with TLS, even for origins that are hosted in Azure. This approach ensures that your data is always encrypted during transit.
40+
41+
For more information, see [End-to-end TLS with Azure Front Door](end-to-end-tls.md).
42+
43+
### Use HTTP to HTTPS redirection
44+
45+
It's a good practice for clients to use HTTPS to connect to your service. However, sometimes you need to accept HTTP requests to allow for older clients or clients who might not understand the best practice.
46+
47+
You can configure Front Door to automatically redirect HTTP requests to use the HTTPS protocol. You should enable the *Redirect all traffic to use HTTPS* setting on your route.
48+
49+
### Use managed TLS certificates
50+
51+
When Front Door manages your TLS certificates, it reduces your operational costs, and helps you to avoid costly outages caused by forgetting to renew a certificate. Front Door automatically issues and rotates managed TLS certificates.
52+
53+
For more information, see [Configure HTTPS on an Azure Front Door custom domain using the Azure portal](standard-premium/how-to-configure-https-custom-domain.md).
54+
55+
### Use 'Latest' version for customer-managed certificates
56+
57+
If you decide to use your own TLS certificates, then consider setting the Key Vault certificate version to 'Latest'. By using 'Latest', you avoid having to reconfigure Front Door to use new versions of your certificate and waiting for the certificate to be deployed throughout Front Door's environments.
58+
59+
For more information, see [Select the certificate for Azure Front Door to deploy](standard-premium/how-to-configure-https-custom-domain.md#select-the-certificate-for-azure-front-door-to-deploy).
60+
61+
## Domain name best practices
62+
63+
### Use the same domain name on Front Door and your origin
64+
65+
Front Door can rewrite the `Host` header of incoming requests. This feature can be helpful when you manage a set of customer-facing custom domain names that route to a single origin. The feature can also help when you want to avoid configuring custom domain names in Front Door and at your origin. However, when you rewrite the `Host` header, request cookies and URL redirections might break. In particular, when you use platforms like Azure App Service, features like [session affinity](/azure/app-service/configure-common#configure-general-settings) and [authentication and authorization](/azure/app-service/overview-authentication-authorization) might not work correctly.
66+
67+
Before you rewrite the `Host` header of your requests, carefully consider whether your application is going to work correctly.
68+
69+
For more information, see [Preserve the original HTTP host name between a reverse proxy and its back-end web application](/azure/architecture/best-practices/host-name-preservation).
70+
71+
## Web application firewall (WAF)
72+
73+
### Enable the WAF
74+
75+
For internet-facing applications, we recommend you enable the Front Door web application firewall (WAF) and configure it to use managed rules. When you use a WAF and Microsoft-managed rules, your application is protected from a range of attacks.
76+
77+
For more information, see [Web Application Firewall (WAF) on Azure Front Door](web-application-firewall.md).
78+
79+
### Follow WAF best practices
80+
81+
The WAF for Front Door has its own set of best practices for its configuration and use. For more information, see [Best practices for Web Application Firewall on Azure Front Door](../web-application-firewall/afds/waf-front-door-best-practices.md).
82+
83+
## Health probe best practices
84+
85+
### Disable health probes when there’s only one origin in an origin group
86+
87+
Front Door's health probes are designed to detect situations where an origin is unavailable or unhealthy. When a health probe detects a problem with an origin, Front Door can be configured to send traffic to another origin in the origin group.
88+
89+
If you only have a single origin, Front Door always routes traffic to that origin even if its health probe reports an unhealthy status. The status of the health probe doesn't do anything to change Front Door's behavior. In this scenario, health probes don't provide a benefit and you should disable them to reduce the traffic on your origin.
90+
91+
For more information, see [Health probes](health-probes.md).
92+
93+
### Select good health probe endpoints
94+
95+
Consider the location where you tell Front Door's health probe to monitor. It's usually a good idea to monitor a webpage or location that you specifically design for health monitoring. Your application logic can consider the status of all of the critical components required to serve production traffic including application servers, databases, and caches. That way, if any component fails, Front Door can route your traffic to another instance of your service.
96+
97+
For more information, see the [Health Endpoint Monitoring pattern](/azure/architecture/patterns/health-endpoint-monitoring)
98+
99+
### Use HEAD health probes
100+
101+
Health probes can use either the GET or HEAD HTTP method. It's a good practice to use the HEAD method for health probes, which reduces the amount of traffic load on your origins.
102+
103+
For more information, see [Supported HTTP methods for health probes](health-probes.md#supported-http-methods-for-health-probes).
104+
105+
## Next steps
106+
107+
Learn how to [create an Front Door profile](create-front-door-portal.md).
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: Best practices for Web Application Firewall on Azure Front Door
3+
description: In this article, you learn about the best practices for using the web application firewall with Azure Front Door.
4+
services: web-application-firewall
5+
author: johndowns
6+
ms.service: web-application-firewall
7+
ms.topic: conceptual
8+
ms.date: 07/18/2022
9+
ms.author: jodowns
10+
11+
---
12+
13+
# Best practices for Web Application Firewall (WAF) on Azure Front Door
14+
15+
This article summarizes best practices for using the web application firewall (WAF) on Azure Front Door.
16+
17+
## General best practices
18+
19+
### Enable the WAF
20+
21+
For internet-facing applications, we recommend you enable a web application firewall (WAF) and configure it to use managed rules. When you use a WAF and Microsoft-managed rules, your application is protected from a range of attacks.
22+
23+
### Tune your WAF
24+
25+
The rules in your WAF should be tuned for your workload. If you don't tune your WAF, it might accidentally block requests that should be allowed. Tuning might involve creating [rule exclusions](waf-front-door-exclusion.md) to reduce false positive detections.
26+
27+
While you tune your WAF, consider using [detection mode](waf-front-door-policy-settings.md#waf-mode), which logs requests and the actions the WAF would normally take, but doesn't actually block any traffic.
28+
29+
For more information, see [Tuning Web Application Firewall (WAF) for Azure Front Door](waf-front-door-tuning.md).
30+
31+
### Use prevention mode
32+
33+
After you've tuned your WAF, you should configure it to [run in prevention mode](waf-front-door-policy-settings.md#waf-mode). By running in prevention mode, you ensure the WAF actually blocks requests that it detects are malicious. Running in detection mode is useful while you tune and configure your WAF, but provides no protection.
34+
35+
## Managed ruleset best practices
36+
37+
### Enable default rule sets
38+
39+
Microsoft's default rule sets are designed to protect your application by detecting and blocking common attacks. The rules are based on a various sources including the OWASP top 10 attack types and information from Microsoft Threat Intelligence.
40+
41+
For more information, see [Azure-managed rule sets](afds-overview.md#azure-managed-rule-sets).
42+
43+
### Enable bot management rules
44+
45+
Bots are responsible for a significant proportion of traffic to web applications. The WAF's bot protection rule set categorizes bots based on whether they're good, bad, or unknown. Bad bots can then be blocked, while good bots like search engine crawlers are allowed through to your application.
46+
47+
For more information, see [Bot protection rule set](afds-overview.md#bot-protection-rule-set).
48+
49+
### Use the latest ruleset versions
50+
51+
Microsoft regularly updates the managed rules to take account of the current threat landscape. Ensure that you regularly check for updates to Azure-managed rule sets.
52+
53+
For more information, see [Web Application Firewall DRS rule groups and rules](waf-front-door-drs.md).
54+
55+
## Rate limiting best practices
56+
57+
### Add rate limiting
58+
59+
Front Door's WAF enables you to control the number of requests allowed from each client's IP address over a period of time. It's a good practice to add rate limiting to reduce the impact of clients accidentally or intentionally sending large amounts of traffic to your service, such as during a [*retry storm*](/azure/architecture/antipatterns/retry-storm/).
60+
61+
For more information, see the following resources:
62+
- [Configure a Web Application Firewall rate limit rule using Azure PowerShell](waf-front-door-rate-limit-powershell.md).
63+
- [Why do additional requests above the threshold configured for my rate limit rule get passed to my backend server?](waf-faq.yml#why-do-additional-requests-above-the-threshold-configured-for-my-rate-limit-rule-get-passed-to-my-backend-server-)
64+
65+
## Geo-filtering best practices
66+
67+
### Geo-filter traffic
68+
69+
Many web applications are designed for users within a specific geographic region. If this situation applies to your application, consider implementing geo-filtering to block requests that come from outside of the countries you expect to receive traffic from.
70+
71+
For more information, see [What is geo-filtering on a domain for Azure Front Door Service?](waf-front-door-tutorial-geo-filtering.md).
72+
73+
### Specify the unknown (ZZ) location
74+
75+
Some IP addresses aren't mapped to locations in our dataset. When an IP address can't be mapped to a location, the WAF assigns the traffic to the unknown (ZZ) country. To avoid blocking valid requests from these IP addresses, consider allowing the unknown (ZZ) country through your geo-filter.
76+
77+
For more information, see [What is geo-filtering on a domain for Azure Front Door Service?](waf-front-door-tutorial-geo-filtering.md).
78+
79+
## Logging
80+
81+
### Add diagnostic settings to save your WAF's logs
82+
83+
Front Door's WAF integrates with Azure Monitor. It's important to save the WAF logs to a destination like Log Analytics. You should review the WAF logs regularly. Reviewing logs helps you to [tune your WAF policies to reduce false-positive detections](#tune-your-waf), and to understand whether your application has been the subject of attacks.
84+
85+
For more information, see [Azure Web Application Firewall monitoring and logging](waf-front-door-monitor.md).
86+
87+
### Send logs to Microsoft Sentinel
88+
89+
Microsoft Sentinel is a security information and event management (SIEM) system, which imports logs and data from multiple sources to understand the threat landscape for your web application and overall Azure environment. Front Door's WAF logs should be imported into Microsoft Sentinel or another SIEM so that your internet-facing properties are included in its analysis. For Microsoft Sentinel, use the Azure WAF connector to easily import your WAF logs.
90+
91+
For more information, see [Using Microsoft Sentinel with Azure Web Application Firewall](../waf-sentinel.md).
92+
93+
## Next steps
94+
95+
Learn how to [create a Front Door WAF policy](waf-front-door-create-portal.md).
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
title: Best practices for Web Application Firewall on Azure Application Gateway
3+
description: In this tutorial, you learn about the best practices for using the web application firewall with Application Gateway.
4+
services: web-application-firewall
5+
author: vhorne
6+
ms.service: web-application-firewall
7+
ms.topic: tutorial
8+
ms.date: 07/18/2022
9+
ms.author: jodowns
10+
---
11+
12+
# Best practices for Web Application Firewall on Application Gateway
13+
14+
This article summarizes best practices for using the web application firewall (WAF) on Azure Application Gateway.
15+
16+
## General best practices
17+
18+
### Enable the WAF
19+
20+
For internet-facing applications, we recommend you enable a web application firewall (WAF) and configure it to use managed rules. When you use a WAF and Microsoft-managed rules, your application is protected from a range of attacks.
21+
22+
### Use WAF policies
23+
24+
WAF policies are the new resource type for managing your Application Gateway WAF. If you have older WAFs that use WAF Configuration resources, you should migrate to WAF policies to take advantage of the latest features.
25+
26+
For more information, see the following resources:
27+
- [Migrate Web Application Firewall policies using Azure PowerShell](./migrate-policy.md)
28+
- [Upgrade Application Gateway WAF configuration to WAF policy using Azure Firewall Manager](../shared/manage-policies.md#upgrade-application-gateway-waf-configuration-to-waf-policy)
29+
30+
### Tune your WAF
31+
32+
The rules in your WAF should be tuned for your workload. If you don't tune your WAF, it might accidentally block requests that should be allowed. Tuning might involve creating [rule exclusions](application-gateway-waf-configuration.md) to reduce false positive detections.
33+
34+
While you tune your WAF, consider using [detection mode](create-waf-policy-ag.md#configure-waf-rules-optional), which logs requests and the actions the WAF would normally take, but doesn't actually block any traffic.
35+
36+
For more information, see [Troubleshoot Web Application Firewall (WAF) for Azure Application Gateway](web-application-firewall-troubleshoot.md).
37+
38+
### Use prevention mode
39+
40+
After you've tuned your WAF, you should configure it to [run in prevention mode](create-waf-policy-ag.md#configure-waf-rules-optional). By running in prevention mode, you ensure the WAF actually blocks requests that it detects are malicious. Running in detection mode is useful while you tune and configure your WAF, but provides no protection.
41+
42+
## Managed ruleset best practices
43+
44+
### Enable core rule sets
45+
46+
Microsoft's core rule sets are designed to protect your application by detecting and blocking common attacks. The rules are based on a various sources including the OWASP top 10 attack types and information from Microsoft Threat Intelligence.
47+
48+
For more information, see [Web Application Firewall CRS rule groups and rules](application-gateway-crs-rulegroups-rules.md).
49+
50+
### Enable bot management rules
51+
52+
Bots are responsible for a significant proportion of traffic to web applications. The WAF's bot protection rule set categorizes bots based on whether they're good, bad, or unknown. Bad bots can then be blocked, while good bots like search engine crawlers are allowed through to your application.
53+
54+
For more information, see [Azure Web Application Firewall on Azure Application Gateway bot protection overview](bot-protection-overview.md).
55+
56+
### Use the latest ruleset versions
57+
58+
Microsoft regularly updates the managed rules to take account of the current threat landscape. Ensure that you regularly check for updates to Azure-managed rule sets.
59+
60+
For more information, see [Web Application Firewall CRS rule groups and rules](application-gateway-crs-rulegroups-rules.md).
61+
62+
## Geo-filtering best practices
63+
64+
### Geo-filter traffic
65+
66+
Many web applications are designed for users within a specific geographic region. If this situation applies to your application, consider implementing geo-filtering to block requests that come from outside of the countries you expect to receive traffic from.
67+
68+
For more information, see [Geomatch custom rules](geomatch-custom-rules.md).
69+
70+
## Logging
71+
72+
### Add diagnostic settings to save your WAF's logs
73+
74+
Application Gateway's WAF integrates with Azure Monitor. It's important to save the WAF logs to a destination like Log Analytics. You should review the WAF logs regularly. Reviewing logs helps you to [tune your WAF policies to reduce false-positive detections](#tune-your-waf), and to understand whether your application has been the subject of attacks.
75+
76+
For more information, see [Azure Web Application Firewall Monitoring and Logging](application-gateway-waf-metrics.md).
77+
78+
### Send logs to Microsoft Sentinel
79+
80+
Microsoft Sentinel is a security information and event management (SIEM) system, which imports logs and data from multiple sources to understand the threat landscape for your web application and overall Azure environment. Application Gateway's WAF logs should be imported into Microsoft Sentinel or another SIEM so that your internet-facing properties are included in its analysis. For Microsoft Sentinel, use the Azure WAF connector to easily import your WAF logs.
81+
82+
For more information, see [Using Microsoft Sentinel with Azure Web Application Firewall](../waf-sentinel.md).
83+
84+
## Next steps
85+
86+
Learn how to [enable the WAF on an Application Gateway](application-gateway-web-application-firewall-portal.md).

articles/web-application-firewall/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
href: ./ag/bot-protection-overview.md
6767
- name: WAF engine
6868
href: ./ag/waf-engine.md
69+
- name: Best practices
70+
href: ./ag/best-practices.md
6971
- name: FAQ
7072
href: ./ag/application-gateway-waf-faq.yml
7173
- name: Front Door
@@ -82,6 +84,8 @@
8284
href: ./afds/waf-front-door-policy-settings.md
8385
- name: Geo-filtering
8486
href: ./afds/waf-front-door-geo-filtering.md
87+
- name: Best practices
88+
href: ./afds/waf-front-door-best-practices.md
8589
- name: FAQ
8690
href: ./afds/waf-faq.yml
8791
- name: Security

0 commit comments

Comments
 (0)