cloudfront CloudFront geographic restrictions 如何显示错误页面,而不是简单的报错。

0

cloudfront CloudFront geographic restrictions 如何显示错误页面,而不是简单的报错。

caesar
已提问 4 个月前203 查看次数
1 回答
1

目前 CloudFront 可以设定 Custom Error Page[1],例如你可以定义 403 错误指定一个路径的内容显示。 其中当请求被 CloudFront GeoRestriction 阻挡时,也适用 Custom Error Page 的功能,你可以让他显示另外一个路径的错误画面。

请留意这个功能只能针对 Error Code 做页面的复写,当你配置这个功能之后,所有的 403 错误都会显示一样的自订义错误画面。如果你只希望 GeoRestriction 的 403 有自定义的画面,您需要考虑使用 WAF Geo match rule 的功能[2] 搭配 WAF 的自订义响应页面 [3] 达成。

希望这个资讯对你有帮助。

[1] https://docs.aws.amazon.com/zh_cn/AmazonCloudFront/latest/DeveloperGuide/GeneratingCustomErrorResponses.html#creating-custom-error-pages

[2] https://docs.aws.amazon.com/zh_cn/waf/latest/developerguide/waf-rule-statement-type-geo-match.html

[3] https://docs.aws.amazon.com/zh_cn/waf/latest/developerguide/waf-custom-request-response.html

profile picture
已回答 3 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则