Trouble with Google storage CNAME record

Hello, dear friends! I have some troubles that I can not resolve by myself. I have a Storage bucket operated by my CMS. Path example looks like this:

https://upload-5555555.commondatastorage.googleapis.com/iblock/26.webp

Now I would like to serve this content via my subdomain: cdn.mydomain.com

I go to DNS records and try this:

Show More
CNAME cdn => c.storage.googleapis.com

Then I have "no such bucket error". I understand, that bucket`s name should be cdn.mydomain.com, but is it possible to use my current name?

I also tried this:

Show More
CNAME upload-5555555 => c.storage.googleapis.com
CNAME cdn => upload-5555555.commondatastorage.googleapis.com

But nothing worked for me. Could you please tell me where I am doing it wrong? Domain is verified in Google console and is served by cloudflare.

Solved Solved
0 3 2,301
1 ACCEPTED SOLUTION

glen_yu
Google Developer Expert
Google Developer Expert

Hi,

Your bucket name needs to be the same as your URL/domain name. 

 

So your domain is: mydomain.com and you want to serve cdn.mydomain.com off of a GCS bucket correct?  Then you need to do the following:
1. make GCS bucket called:  cdn.mydomain.com

2. add CNAME record: cdn --> c.storage.googleapis.com

3. put your web files in your bucket, you may have to click the 3 dots (...) on the right side and "Edit website configuration" to tell it what file they should be looking for (i.e. index.html)

 

 

Following the same pattern, if you wanted another subdomain called support.mydomain.com, then you create a support.mydomain.com GCS bucket, and CNAME support --> c.storage.googleapis.com

 

Does that answer your question?

View solution in original post

3 REPLIES 3

glen_yu
Google Developer Expert
Google Developer Expert

Hi,

Your bucket name needs to be the same as your URL/domain name. 

 

So your domain is: mydomain.com and you want to serve cdn.mydomain.com off of a GCS bucket correct?  Then you need to do the following:
1. make GCS bucket called:  cdn.mydomain.com

2. add CNAME record: cdn --> c.storage.googleapis.com

3. put your web files in your bucket, you may have to click the 3 dots (...) on the right side and "Edit website configuration" to tell it what file they should be looking for (i.e. index.html)

 

 

Following the same pattern, if you wanted another subdomain called support.mydomain.com, then you create a support.mydomain.com GCS bucket, and CNAME support --> c.storage.googleapis.com

 

Does that answer your question?

Thank you for your reply. I did exactly as you said. Created a bucket with same name and then all worked. It is sad, that I can not adjust a domain name to randomly named bucket.

What about SSL cert?