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

Is there a way to have cloudfront send a single resource and the default root object for any path / route?

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

我想这样做,以便任何不是针对特定资源的请求都服务于相同的默认 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*

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

几乎解决了问题,但我没有 "static" 域,所以我不确定如何使用它。

感谢任何意见

A​​mazon CloudFront 似乎能够 Customize Error Responses:

If you'd rather display a custom error message, possibly using the same formatting as the rest of your website, you can have CloudFront return to the viewer an object (for example, an HTML file) that contains your custom error message.


(来源:amazon.com