amazon-web-servicesamazon-s3cdnamazon-cloudfront

Cloudfront: setting s3 path difference from Origin


Cache behaviour setting, i use

s3/*

to redirect request to s3 folder, but i don't want to place my images under a folder named s3 but right under s3 bucket to redirect like this:

xxxx.cloudfront.com/s3/images/1.png  -> bucket_name/images/1.png

not

xxxx.cloudfront.com/s3/images/1.png  -> bucket_name/s3/images/1.png

Please help to show me how to config like this.


Solution

  • I don't think this is possible. An Origin Path can redirect to a subdirectory, (eg index.htm -> production/index.htm) but CloudFront can't strip out path portions.

    See documentation: Origin Path

    Some options: