website icon indicating copy to clipboard operation
website copied to clipboard

Wrong origin of CloudFront distribution

Open ngocanh08431 opened this issue 6 years ago • 1 comments

I have tried to create my serverless blog with custom domain sls-blog.myowndomain.xyz

    []
    bucketName: 'sls-blog.myowndomain.xyz' 
    domain: sls-blog.myowndomain.xyz
    []

But it ends up with the error as below when I access my own domain

<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist</Message>
<BucketName>sls-blog</BucketName>

When I navigate to the Cloudfront Console, I recognize that the CloudFront distribution is trying access the origin as sls-blog.s3.amazonaws.com. Which I really have no chance to own it.

I tried to change the origin to the s3 bucket website domain and It seems to be working now.

Is Serverless components mistaking on create cloudfront distribution ? I have check the code and find nothing seem to be wrong.

ngocanh08431 avatar Mar 18 '20 14:03 ngocanh08431

For now, you cannot use domain name with dot (.), you have to replace dot to another character (i.e. -). For example sls-blog-myowndomain-xyz will work.

Check out more details at https://medium.com/innomizetech/how-do-we-host-our-static-website-b0b60f2a09f2

hoangleitvn avatar Mar 26 '20 04:03 hoangleitvn