Cụt*_*ánh 4 cdn amazon-s3 amazon-web-services amazon-cloudfront
缓存行为设置,我使用
s3/*
Run Code Online (Sandbox Code Playgroud)
将请求重定向到s3文件夹,但我不想将我的图像放在名为s3的文件夹下,而是在s3存储桶下以这种方式重定向:
xxxx.cloudfront.com/s3/images/1.png -> bucket_name/images/1.png
Run Code Online (Sandbox Code Playgroud)
不
xxxx.cloudfront.com/s3/images/1.png -> bucket_name/s3/images/1.png
Run Code Online (Sandbox Code Playgroud)
请帮我示范如何进行配置。
xen*_*ide 11
您可以使用lambda做到这一点,这是相关的lambda代码段。
exports.handler = (event, context, callback) => {
// this is the request we want to re-map
var request = event.Records[0].cf.request;
// the request has a 'uri' property which is the value we want to overwrite
// rewrite the url applying your custom logic
request.uri = 'some custom logic here to rewrite the url';
// quit the lambda and let the request chain continue
callback( null, request );
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2871 次 |
| 最近记录: |