cloudfront实现nginx的行为
默认根对象 如果您定义默认根对象,最终用户对分配的子目录的请求不返回默认根对象。例如,假设 index.html 是您的默认根对象且 CloudFront 接收最终用户对 CloudFront 分配下的 install 目录的请求: https://d111111abcdef8.cloudfront.net/install/ CloudFront 不会返回默认根对象,即使 index.html 的副本出现在install目录中。 此时一个空资源作为文件被下载下来 这与我们常用的nginx目录访问明显的不同 实现与nginx类似的行为 以下示例函数会将 index.html 附加到不在 URL 中包含文件名或扩展名的请求中。此函数对于托管在 Amazon S3 存储桶中的单页应用程序或静态生成的网站非常有用。 在 GitHub 上查看此示例 function handler(event) { var request = event.request; var uri = request.uri; // Check whether the URI is missing a file name. if (uri.endsWith('/')) { request.uri +=... » read more