有没有办法让cloudfront发送单个资源和任何路径/路由的默认根对象?

时间:2017-03-03 02:16:20

标签: amazon-web-services amazon-s3 amazon-cloudfront

我有一个普通的s3存储桶(未设置为静态网站服务)和cloudfront。

我想这样做,以便任何不属于特定资源的请求都提供相同的默认index.html文件。这是正确的吗?

换句话说,请求

www.example.com/file.jpg -> returns file.jpg
www.example.com/ -> returns index.html
www.example.com/thing/test -> *the same index.html file as above*

有没有办法为所有不匹配的路径映射通配符?

This answer几乎解决了这一点,但我没有"静态"域名,所以我不知道如何使用它。

我感谢任何输入

1 个答案:

答案 0 :(得分:0)

Amazon CloudFront似乎能够Customize Error Responses

  

如果您希望显示自定义错误消息,可能使用与网站其余部分相同的格式,则可以让CloudFront向查看器返回包含自定义错误消息的对象(例如,HTML文件)

Custom error response