I have a CDN and 2 buckets
one bucket is using the default behaviour so img.png
is accessible via CDN URL: cdn.com/img.png
one bucket is using the /path
behaviour so everything in the CDN routed to /path should go to this bucket. It works when i put this in the bucket: path/test.png
. I can visit cdn.com/path/test.png
.
What I want is to put test.png
in the root of my bucket without the prefix of path/
. Is this possible (without the use of lambda@edge)?
If you want to rewrite the path, you have to use lambda@edge.
If you are ok with 301 redirection, you can try enabling static website hosting on S3 bucket and use the following redirection rule :
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>path/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyPrefixWith/>
</Redirect>
</RoutingRule>
</RoutingRules>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.