skip to Main Content

Problem: Using my CNAME on cloudflare (assets.my-site.com) I am trying to point to a public AWS S3 bucket. If I navigate to the AWS hostname I can clearly see it working in multiple browsers (public read access is correct) however when I try to access via assets.my-site.com (cloudflare CNAME) I get the error

<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist</Message>
<BucketName>assets.my-site.com</BucketName>

Im pretty sure the issue is with this <BucketName>assets.my-site.com</BucketName> that somehow amazon is picking up assets.my-site.com as the hostname of the bucket instead of the correct S3 target

enter image description here

2

Answers


  1. I believe yes, you need to rewrite host header here, you can do that for example via Cloudflare Page Rules, you need to put your CNAME to the URL (required) field, and name of the bucket to the value, it should looks like:
    enter image description here

    Login or Signup to reply.
  2. The other answers and comments have basically answered this, but to answer this clearly your bucket needs to be named assets.my-site.com. From the error it’s fairly clear my-bucket is a different value than assets.my-site.com.

    I have posted a similar answer that shows how to serve a static bucket using Cloudflare to dramatically reduce bandwidth usage here.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search