cloudfront path pattern example for multiple subdomain origins

让人想犯罪 __ 提交于 2019-12-11 03:09:31

问题


For example, a cloudfront distribution has the following CNAMEs associated with it

photo-cdn.example.com
video-cdn.example.com
music-cdn.example.com

And it has the following origins associated with it

originA: photo.example.com/photocontents
originB: video.example.com/videocontents
originC: music.example.com/musiccontents

I would like to be able to GET the following content files via the Cloudfront distribution as mapped below:

photo-cdn.example.com/photo.jpg => originA/photo.jpg
photo-cdn.example.com/image.png => originA/image.png

video-cdn.example.com/video.mpg => originB/video.mpg
video-cdn.example.com/movie.avi => originB/poster.jpg

music-cdn.example.com/music.mp3 => originC/music.mp3
music-cdn.example.com/itune.wav => originC/albumart.png

What should be the specific path patterns that i need to use to achieve this behavior?

Will the path pattern evaluation happen only on the SUFFIX of the distribution domain path (after music-cdn.example.com/)?

Or will the path pattern evaluation INCLUDE the distribution domain path (include music-cdn.example.com).


回答1:


As long as you don't have overlapping file types you can use masks like /*.jpg, /*.png, /*.mpg etc.

But it won't work e.g. if you need to fetch .jpg album art from your music-cdn domain.

In this case you might need to split this into 3 different distributions, each having a single CNAME

EDIT: read the comments below for further clarification on which portions of the CNAME are actually evaluated by the path pattern evaluation



来源:https://stackoverflow.com/questions/29500759/cloudfront-path-pattern-example-for-multiple-subdomain-origins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!