Setting up SSL for Google Cloud Storage static website?

SslGoogle Cloud-Storage

Ssl Problem Overview


Is there any way to serve a static website (SPA actually) located on Google Cloud Storage via SSL, for that nice SSL address and icon for users to see?

Amazon allows this via CloudFront SNI.

Ssl Solutions


Solution 1 - Ssl

Yes!

Using GCS directly via CNAME redirects only allows HTTP traffic.

To use HTTPS with your own domain, you'll need to set up Google Cloud Load Balancer, and optionally you'll want to set up Google Cloud CDN as well. While it adds a bit of complexity, Google Cloud Load Balancer allows you to fill a domain with all sorts of content. Some resources could be served by a GCS bucket, but you could also have servers in GCE serving dynamic content for other paths.

There are instructions for setting this up here: https://cloud.google.com/compute/docs/load-balancing/http/using-http-lb-with-cloud-storage.

Solution 2 - Ssl

An alternative would be to host your domain DNS server at CloudFlare. They give free HTTPS to HTTP service.


More Info:

Solution 3 - Ssl

As of April 2019: https://cloud.google.com/storage/docs/troubleshooting#https

> HTTPS serving Issue: I want my content served through HTTPS. > > Solution: While you can serve your content through HTTPS using direct > URIs such as https://storage.googleapis.com/my-bucket/my-object, when > hosting a static website using a CNAME redirect, Cloud Storage only > supports HTTP. To serve your content through a custom domain over SSL, > set up a load balancer, use a third-party Content Delivery Network > with Cloud Storage, or serve your static website content from Firebase > Hosting instead of Cloud Storage.

Pretty shocking in this day and age that with letsEncrypt everywhere they have not figured out how to do this.

Solution 4 - Ssl

An alternative would be to host your SPA on https://firebase.com>Firebase.</a> All apps have SSL included by default even those with custom domains. They also have a CLI that makes it easy to deploy!

Solution 5 - Ssl

If you're not tied to Cloud Storage, another alternative to host your SPA directly on App Engine, using static files. Follow this tutorial for something more compreensive.

If you still want your SPA to be stored in a Cloud Storage bucket, you can use this project to serve it through App Engine. You can host multiple websites with a single app, in fact.

Using App Engine either way, you'll get a free managed certificate, and a free monthly allowance.

Solution 6 - Ssl

For simplicity use FireBase, the command to update is ssh firebase deploy Iv done a few thousand html files in a matter of seconds.

I would also recommend the free service CloudFlare provides as well for an extra level of protection.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSyBerView Question on Stackoverflow
Solution 1 - SslBrandon YarbroughView Answer on Stackoverflow
Solution 2 - SslAminadav GlickshteinView Answer on Stackoverflow
Solution 3 - SslDavid DehghanView Answer on Stackoverflow
Solution 4 - Ssluser3453273View Answer on Stackoverflow
Solution 5 - SslNuno CrucesView Answer on Stackoverflow
Solution 6 - SslPHILL BOOTHView Answer on Stackoverflow