Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to point both root and sub domain to Google Cloud Storage bucket?

Tags:

I've successfully created a static website hosted on Google Cloud Storage.

The bucket name is like: www.example.com

and my CNAME record for www points to c.storage.googleapis.com

I've verified both the www and root domain with Google Webmaster Tools.

On Google Webmaster Tools I have the www set as the primary domain (I have no idea if that's relevant, but saw a reference to it on another post here) and it's important that I serve the site from the www subdomain and not the root.

I can reach www.example.com fine,but no matter what I try with my root domain I only get the <NoSuchBucket> error.

Point of information: My DNS is managed by Cloudflare. When I use Github pages to host static sites I typically point the root to the www with a CNAME record (and no A record at all because Cloudflare allows CNAME flattening), but that does not work here.

I've tried pointing my root domain to the www with a CNAME record and tried pointing it to c.storage.googleapis.com.

The Cloud Storage website configuration documentation for Step 2 says: "For example, for example.com, the CNAME record contains the following information: www CNAME c.storage.googleapis.com" but makes no mention of pointing the root domain, yet this must be a common requirement.

I realize I could create an additional bucket with the root domain and point it to the www in http, but it seems as though there should be a way to do this with DNS records.

like image 254
Bud Parr Avatar asked Dec 28 '14 17:12

Bud Parr


People also ask

How do I change the location of a GCP bucket?

You cannot change a bucket's location after it's created, but you can move your data to a bucket in a different location.

Which command line tool works with Google Cloud Storage buckets?

gsutil is a Python application that lets you access Cloud Storage from the command line. You can use gsutil to do a wide range of bucket and object management tasks, including: Creating and deleting buckets. Uploading, downloading, and deleting objects.


1 Answers

There is nothing you can do on Google Storage side to point example.com root domain to www.example.com bucket. The only option is redirecting/forwarding example.com to www.example.com on your DNS provider:

Check these links for forwarding on the Cloudflare:

https://blog.cloudflare.com/introducing-pagerules-url-forwarding/

https://support.cloudflare.com/hc/en-us/articles/200172286-How-do-I-do-url-forwarding-with-CloudFlare-

like image 111
Kamran Avatar answered Sep 19 '22 19:09

Kamran