本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
Amazon WAF机器人控制示例:仅对动态内容使用 Bot Control
此示例使用范围缩小语句来应用Amazon WAF机器人控制仅限动态内容。
scope-down 语句通过否定正则表达式模式集的匹配结果来排除静态内容:
-
正则表达式模式集配置为匹配的扩展名静态内容. 例如,正则表达式模式集规范可能是
(?i)\.(jpe?g|gif|png|svg|ico|css|js|woff2?)$. 有关正则表达式模式集和语句的信息,请参见正则表达式模式集匹配规则语句. -
在 scope-down 语句中,我们通过将 regex pattern set 语句嵌套在 scope-down 语句中来排除匹配的静态内容
NOT语句。有关以下内容的信息NOT语句,登录NOT规则语句.
{ "Name": "AWS-AWSBotControl-Example", "Priority": 5, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "AWS", "Name": "AWSManagedRulesBotControlRuleSet", "ExcludedRules": [ { "Name": "CategoryVerifiedSearchEngine" }, { "Name": "CategoryVerifiedSocialMedia" } ] }, "VisibilityConfig": { "SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "AWS-AWSBotControl-Example" }, "ScopeDownStatement": { "NotStatement": { "Statement": { "RegexPatternSetReferenceStatement": { "ARN": "arn:aws:wafv2:us-east-1:123456789:regional/regexpatternset/excludeset/00000000-0000-0000-0000-000000000000", "FieldToMatch": { "UriPath": {} }, "TextTransformations": [ { "Priority": 0, "Type": "NONE" } ] } } } } } }