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

0

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

caesar
已提問 5 個月前檢視次數 209 次
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
已回答 4 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南