Skip to content

Instantly share code, notes, and snippets.

@liamnewmarch
Last active February 24, 2024 13:10
Show Gist options
  • Save liamnewmarch/8d1c1cd86e153f3296809786edf8d560 to your computer and use it in GitHub Desktop.
Save liamnewmarch/8d1c1cd86e153f3296809786edf8d560 to your computer and use it in GitHub Desktop.
App Engine config for static sites with 404
# This app.yaml file assumes your static site is built into a directory called dist.
# Make sure dist only contains files you want to be made public. At a minimum, dist
# should contain an index.html and a 404.html.
# This can be any standard environment https://cloud.google.com/appengine/docs/standard/
runtime: python312
handlers:
# Handle files
- url: /(.+)
require_matching_file: true
static_files: dist/\1
upload: dist/(.+)
# Handle directories
- url: /(.+)/
require_matching_file: true
static_files: dist/\1/index.html
upload: dist/(.*)/index.html
# Handle root index
- url: /
require_matching_file: true
static_files: dist/index.html
upload: dist/index.html
# Handle not found
- url: /.*
static_files: dist/404.html
upload: dist/404.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment