Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I specify a path pattern of "/" in a CloudFront behavior?

I have a CloudFront distribution with an S3 origin. I want to create a behavior such that requests to the root path of the site will use a different origin (a webservice).

So ideally my behaviors would be:

  • "/" - webservice origin
  • Default (*) - S3 bucket

However, the above doesn't seem to work - the root request isn't caught by the first behavior.

Is there any way I can accomplish what I want using path patterns?

like image 809
Mike Avatar asked Jun 30 '16 09:06

Mike


1 Answers

The answer is that a Cache Behavior with a Path Pattern of '/' does work to only match the root url. In this particular case, the user also had a default root object set which gets matched before the behavior patterns. Removing the default root object is necessary if you wish to define a cache behavior on the root url using the '/' pattern.

like image 83
craigts Avatar answered Sep 19 '22 16:09

craigts