How to access multiple S3 origins (in the same buc

2019-08-31 02:55发布

问题:

I have a cloudfront distribution that is working fine with an S3 origin.

After adding a second origin, I also add a new cache behaviour so I would get:

  • first.domain.com: goes to the first origin (via the default * cache behaviour path)
  • first.domain.com/elsewhere: goes to the new origin (via a new elsewhere/* cache behaviour path)

I feel something maybe wrong or missing, but can't tell from the docs what it could be.

After reading these answers:

  • One
  • Two

I can't still figure what is not working. I enabled the S3 logs but they can take hours to update.

Any help is appreciated!

The error I get after hitting the second URL is:

"response": {
"status": 403,
"statusText": "",
"httpVersion": "http/2.0",
"headers": [
  {
    "name": "status",
    "value": "403"
  },
  {
    "name": "content-type",
    "value": "application/xml"
  },
  {
    "name": "date",
    "value": "Fri, 17 Aug 2018 03:28:54 GMT"
  },
  {
    "name": "server",
    "value": "AmazonS3"
  },
  {
    "name": "x-cache",
    "value": "Error from cloudfront"
  },
  {
    "name": "via",
    "value": "1.1 275132367c30f17c9825826491390fe3.cloudfront.net (CloudFront)"
  },
  {
    "name": "x-amz-cf-id",
    "value": "Ag_JzYYNMVJLMlz9Dd8yDgS1qDCRFlihzlCauDXOE0-fojAPQLQNQQ=="
  }

It would seem that the dist has no access, but I did the same OAID as with the first origin, I checked the bucket permissions allow the OAID, and the first origin is working fine.

Maybe it's some slow propagation issue about adding an S3 origin?