Skip to content

Instantly share code, notes, and snippets.

@wchargin
Last active October 29, 2023 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wchargin/326b6f77919488501e3bb0ae9b04b173 to your computer and use it in GitHub Desktop.
Save wchargin/326b6f77919488501e3bb0ae9b04b173 to your computer and use it in GitHub Desktop.
Caddy x GCS reverse proxy via storage.googleapis.com
# requires caddyserver/cache-handler module
{
order cache before rewrite
cache
log default {
output stdout
# http.handlers.cache logs the entire contents of request
# bodies at info level(??!)
exclude http.handlers.cache
}
log gcs {
output stdout
level debug
include http.handlers.reverse_proxy
}
}
my-site.example {
log stdout
@read method GET HEAD OPTIONS
handle @read {
cache
rewrite * /bucket-name{uri}
reverse_proxy https://storage.googleapis.com {
header_up Host {upstream_hostport}
}
}
handle {
header Allow "GET, HEAD, OPTIONS"
respond 405 {
body "405 Method Not Allowed"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment