Επεξεργασία

Κοινή χρήση μέσω


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 exceeds the configured threshold, matching all traffic.

  1. Open an existing Application Gateway WAF Policy.
  2. Select Custom Rules.
  3. Select Add Custom Rule.
  4. Type a name for the custom rule.
  5. For the Rule type, select Rate limit.
  6. Type a Priority for the rule.
  7. Choose 1 minute for Rate limit duration.
  8. Type 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 Does not contain.
  12. For match condition, under IP address or range, type 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 is 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. Select Add Custom Rule.
  4. Type a name for the custom rule.
  5. For the Rule type, select Rate limit.
  6. Type a Priority for the rule.
  7. Choose 1 minute for Rate limit duration.
  8. Type 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 Is not 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. Select Add Custom Rule.
  4. Type a name for the custom rule.
  5. For the Rule type, select Rate limit.
  6. Type a Priority for the rule.
  7. Choose 1 minute for Rate limit duration.
  8. Type 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 Is not for Operation.
  13. For Operator select Contains.
  14. Selecting a transformation optional.
  15. Enter Login page path for match Value. In this example we use /login.
  16. Leave action setting to Deny traffic.
  17. Select Add to add the custom rule to the policy
  18. Select Save to save the configuration and make the custom rule active for the WAF policy.

Next steps

Customize web application firewall rules