将通配符子域映射到 S3 静态站点文件夹
Map wildcard subdomains to S3 static site folders
有没有办法通过混合使用 AWS Cloudfront、S3 和 Route 53 来设置一组静态网站,从而将不定数量的子域(通配符)映射到单个S3 存储桶的文件夹?
例如:
http://first.example.com maps to https://s3.amazonaws.com/example.com/first/index.html
http://second.example.com maps to https://s3.amazonaws.com/example.com/second/index.html
是的,您可以使用 Lambda@Edge 函数来完成。
首先,在 Route53 上映射通配符 (*) 子域。
然后将通配符域*.example.com添加到CloudFront
中的备用域名中
编写一个 Lambda 函数,根据请求中的子域更改原始路径。
查看示例 here
有没有办法通过混合使用 AWS Cloudfront、S3 和 Route 53 来设置一组静态网站,从而将不定数量的子域(通配符)映射到单个S3 存储桶的文件夹?
例如:
http://first.example.com maps to https://s3.amazonaws.com/example.com/first/index.html
http://second.example.com maps to https://s3.amazonaws.com/example.com/second/index.html
是的,您可以使用 Lambda@Edge 函数来完成。
首先,在 Route53 上映射通配符 (*) 子域。
然后将通配符域*.example.com添加到CloudFront
中的备用域名中编写一个 Lambda 函数,根据请求中的子域更改原始路径。 查看示例 here