Muokkaa

Jaa


Create rate limiting custom rules for Application Gateway WAF v2

Rate limiting enables you to detect and block abnormally high levels of traffic destined for your application. Rate Limiting works by counting all traffic that matches the configured Rate Limit rule and performing the configured action for traffic matching that rule which exceeds the configured threshold. For more information, see Rate limiting overview.

Configure Rate Limit Custom Rules

Use the following information to configure Rate Limit Rules for Application Gateway WAFv2.

Scenario One - Create rule to rate-limit traffic by Client IP that exceed the configured threshold, matching all traffic.

  1. Open an existing Application Gateway WAF Policy
  2. Select Custom Rules
  3. Add Custom Rule
  4. Add Name for the Custom Rule
  5. Select the Rate limit Rule Type radio button
  6. Enter a Priority for the rule
  7. Choose 1 minute for Rate limit duration
  8. Enter 200 for Rate limit threshold (requests)
  9. Select Client address for Group rate limit traffic by
  10. Under Conditions, choose IP address for Match Type
  11. For Operation, select the Does not contain radio button
  12. For match condition, under IP address or range, enter 255.255.255.255/32
  13. Leave action setting to Deny traffic
  14. Select Add to add the custom rule to the policy
  15. Select Save to save the configuration and make the custom rule active for the WAF policy.

Scenario Two - Create Rate Limit Custom Rule to match all traffic except for traffic originating from the United States. Traffic will be grouped, counted and rate limited based on the GeoLocation of the Client Source IP address

  1. Open an existing Application Gateway WAF Policy
  2. Select Custom Rules
  3. Add Custom Rule
  4. Add Name for the Custom Rule
  5. Select the Rate limit Rule Type radio button
  6. Enter a Priority for the rule
  7. Choose 1 minute for Rate limit duration
  8. Enter 500 for Rate limit threshold (requests)
  9. Select Geo location for Group rate limit traffic by
  10. Under Conditions, choose Geo location for Match Type
  11. In the Match variables section, select RemoteAddr for Match variable
  12. Select the Is not radio button for operation
  13. Select United States for Country/Region
  14. Leave action setting to Deny traffic
  15. Select Add to add the custom rule to the policy
  16. Select Save to save the configuration and make the custom rule active for the WAF policy.

Scenario Three - Create Rate Limit Custom Rule matching all traffic for the login page, and using the GroupBy None variable. This will group and count all traffic which matches the rule as one, and apply the action across all traffic matching the rule (/login).

  1. Open an existing Application Gateway WAF Policy
  2. Select Custom Rules
  3. Add Custom Rule
  4. Add Name for the Custom Rule
  5. Select the Rate limit Rule Type radio button
  6. Enter a Priority for the rule
  7. Choose 1 minute for Rate limit duration
  8. Enter 100 for Rate limit threshold (requests)
  9. Select None for Group rate limit traffic by
  10. Under Conditions, choose String for Match Type
  11. In the Match variables section, select RequestUri for Match variable
  12. Select the Is not radio button for operation
  13. For Operator select contains
  14. Enter Login page path for match Value. In this example we use /login
  15. Leave action setting to Deny traffic
  16. Select Add to add the custom rule to the policy
  17. Select Save to save the configuration and make the custom rule active for the WAF policy.

Next steps

Customize web application firewall rules