首页 > 解决方案 > Azure Front Door - 如何添加地理筛选策略?

问题描述

我想为美国以外的国家/地区的天蓝色前门应用地理过滤器。

我已经应用了 waf 策略(按照microsoft docs),但我没有得到想要的结果。所有流量似乎都被拒绝。如果我尝试不同的国家代码,似乎所有流量都被允许。

这是我正在尝试使用的拒绝策略的示例。如果我应用此规则并通过 locabrowser 进行测试,则允许流量。

我正在通过使用locabrowser来模拟来自不同位置的流量来测试这个理论。

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
    "frontdoorwebapplicationfirewallpolicies_DenyChinaWafPolicy_name": {
        "defaultValue": "DenyChinaWafPolicy",
        "type": "String"
    }
},
"variables": {},
"resources": [
    {
        "type": "Microsoft.Network/frontdoorwebapplicationfirewallpolicies",
        "apiVersion": "2018-08-01",
        "name": "[parameters('frontdoorwebapplicationfirewallpolicies_DenyChinaWafPolicy_name')]",
        "location": "Global",
        "properties": {
            "policySettings": {
                "enabledState": "Enabled",
                "mode": "Prevention"
            },
            "customRules": {
                "rules": [
                    {
                        "name": "geoFilterRule",
                        "priority": 1,
                        "ruleType": "MatchRule",
                        "rateLimitDurationInMinutes": 1,
                        "rateLimitThreshold": 0,
                        "matchConditions": [
                            {
                                "matchVariable": "RemoteAddr",
                                "operator": "GeoMatch",
                                "negateCondition": false,
                                "matchValue": [
                                    "CH"
                                ]
                            }
                        ],
                        "action": "Block"
                    }
                ]
            },
            "managedRules": {
                "ruleSets": []
            }
        }
    }
  ]
}

标签: azureazure-front-door

解决方案


AFD 中的地理过滤目前已损坏。它包括所有国家而不是特定位置。已修复并将很快发布。修复更新后将在此处更新。


推荐阅读