0

I have a Google Cloud Storage bucket mywebsite-static. Due to browser restrictions on max parallel HTTP connections, I would like to create multiple DNS records in such a way that I can access files within this bucket using static.mywebsite.com, static2.mywebsite.com, etc.

The docs recommend adding CNAME records, but the bucket name must match the CNAME. Keeping content in the one bucket saves synchronising/updating multiple buckets when the static content changes, and is also much cleaner than storing multiple copies of the same static content.

Is there any way to create multiple DNS records in order to reach a single storage bucket?

2 Answers2

0

Not with GCS alone. However, using Google Cloud Load Balancing, you could set up a global forwarding rules which all map to a single backend GCS bucket. This will give you an IP address that you can map to as many DNS names as you like. https://cloud.google.com/compute/docs/load-balancing/http/global-forwarding-rules

The Load Balancer is a powerful tool and can also be used to swap out which GCS bucket you're serving from or let you serve some directories dynamically from GCE or other services.

The downsides are that may be overkill for your use case, configuring this is somewhat complicated, and global forwarding rules aren't cheap, but it will get the job done. It might be easier to look into other options to improve your site, such as CSS sprite sheets.

Brandon Yarbrough
  • 37,021
  • 23
  • 116
  • 145
  • See https://cloud.google.com/compute/docs/load-balancing/http/backend-bucket. Thanks, that's a great suggestion. –  Jan 09 '18 at 00:49
0

As some of the answers in that thread hint, if you are using HTTP 2.0 the parallel connection issue is not a problem. You can use HTTP 2.0 with GCS, so long as you are accessing it via HTTPS. This means either use https://storage.cloud.google.com/bucket/object, https://bucket.storage.cloud.google.com/object or GCLB+Backend bucket. HTTPS doesn't work with the CNAME as GCS won't have a certificate for that domain.

David
  • 9,288
  • 1
  • 20
  • 52
  • This will become the better answer once 2.0 sees widespread adoption. Cheers. –  Jan 16 '18 at 03:32