Last active
October 29, 2023 06:07
-
-
Save wchargin/326b6f77919488501e3bb0ae9b04b173 to your computer and use it in GitHub Desktop.
Caddy x GCS reverse proxy via storage.googleapis.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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