Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.
/ appengine-hosting Public archive

Host static websites with Google Cloud Storage and App Engine

License

Notifications You must be signed in to change notification settings

ncruces/appengine-hosting

Repository files navigation

appengine-hosting

Google Cloud Storage allows you to configure a bucket to host a static website, with one big caveat: no HTTPS support.

Proposed solutions are: a load balancer, a third-party CDN, and Firebase Hosting.

This offers an additional, cost effective, customizable, alternative: a single App Engine app that can host as many static websites as needed.

How and why?

A Go, App Engine app, serves static content from Cloud Storage buckets. Always Free mean you can host this for free, and scale up from there.

Follow the Quickstart for Go App Engine Standard Environment tutorial. Choose the us-central region if you want to take full advantage of Always Free. Don't clean up.

Follow the Hosting a Static Website tutorial. Use the same project as above. For best performance, place the bucket in the same region as above (pick us-central1 for the Always Free allowance). Verify that everything works as expected through the custom domain. Don't clean up.

Now, clone this repository and deploy it to App Engine. Then, map the custom domain for the website to the App Engine app. Wait for the managed SSL certificate to be provisioned for your app, or configure your own SSL certificate.

You should now be able to use HTTPS to access the website.

What works, and what doesn't?

  • Website configuration for the bucket (Main page, and 404 page) is respected by default.
  • Multiple domains can be mapped to the app, content will be served from the corresponding buckets.
  • All HTTP traffic is 301 redirected to HTTPS (see app.yaml)
  • Some security headers are added, many Cloud Storage headers are hidden.
  • Redirects, rewrites, etc, as in Firebase Hosting (see firebase-sample.json).
  • This issue means compressed objects in Cloud Storage larger than 32Mb are not supported (don't use gsutil -z or -Z to upload them).
  • This issue is fixed.

About

Host static websites with Google Cloud Storage and App Engine

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages