Is there any production-ready way to host a static website supporting SSL on GCP? The static website tutorial states that “SSL is not currently supported by the Cloud Storage webservers”, but presumably they serve HTTPS on their own domains. Are there any workarounds or indirect ways to support this?
(A static website may not be sensitive, but SSL is very important for data integrity, speed, and even SEO.)
4
Answers
You’re right, SSL is very important.
I advise you to use Google AppEngine. You have 2 solutions:
1. Continue to store your static pages on GCS (Google Cloud Storage)
Just follow this tutorial in order to call your static pages from GCS with Google AppEngine: https://cloud.google.com/appengine/docs/java/googlecloudstorageclient/app-engine-cloud-storage-sample#reading_a_file_from_cloud_storage
(You can find the same tuto for other languages)
2. Host your static content directly on AppEngine
With AppEngine you can develop a light webserver in order to deliver static pages. Like my example here: https://github.com/mlazzje/weather-forecast-compare-location/blob/master/app.go
My files are stored in the folder “view” here: https://github.com/mlazzje/weather-forecast-compare-location/tree/master/view
Source: https://github.com/mlazzje/weather-forecast-compare-location
(this app was just a test :))
Google cloud storage is currently don’t support that, but you can try Google CDN, which is new and have facilities to serve your static content with https (But you have to paid for their service they have no any free quora on that)
Here is what I read from their document.
So they support custom SSL domain. And as far I know you will get less charges compare to serving content from appengine. Also your static content will serve super fast compare to appengine.
Alternatively, you can use cloudflare free flexible SSL which works everywhere.
At the moment, SSL is not supported. Proposed solutions are: a load balancer, a third-party CDN, and Firebase Hosting.
But as @mlazzje pointed, you can use App Engine to serve your site.
If you’re not tied to Cloud Storage, you can host static content directly on App Engine. Follow this Google tutorial.
If you want to store your files in a Cloud Storage bucket, you can use this GitHub project to serve it through App Engine.
Small update on this. Google Cloud Platform CDN supports now google managed certificates (currently in beta) that enables you to serve a bucket thru a custom domain. They create and update a letsencrypt certificate for you. That means you can serve the content from a bucket thru the Google CDN via https for your domain.
You can find a detailed description here: https://medium.com/@marco_37432/create-a-custom-domain-cdn-with-google-beta-7ad9531dfbae