Store public uploads in a Garage S3 bucket, with garage-webui at /garage/
Opt-in and built so Garage can never take the site down: - the backend writes to the bucket only once S3_ENDPOINT is set, and falls back to the uploads volume (with a log line) if a write fails; - nginx serves /uploads/ from the volume first and Garage's anonymous website endpoint second, so every existing URL keeps working and nginx boots with no garage container; - nothing depends_on garage and no variable is required, so a missing secret cannot fail a deploy. Private attachments stay on disk, since nginx cannot gate a bucket. garage/bootstrap.sh sets up the layout, bucket, key and website access; the runbook is "Garage" in DEPLOYMENT.md. Also lifts the body limit on the internal auth subrequest, which 413'd large uploads to gated locations, and reserves the garage and dozzle page slugs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -47,14 +47,24 @@
|
||||
add_header Content-Security-Policy "default-src 'none'; img-src 'self'; style-src 'none'; script-src 'none'" always;
|
||||
}
|
||||
|
||||
# Both /uploads/ blocks are the production ones MINUS
|
||||
# The /uploads/ blocks (and @uploads_bucket) are the production ones MINUS
|
||||
# `include security_headers.conf`: that file carries HSTS, which must
|
||||
# never be sent from localhost. That one line is why they are not in
|
||||
# the shared route table (see WHAT DOES NOT in
|
||||
# nginx_routes.conf.template). Keep the rest in step with
|
||||
# nginx.conf.template.
|
||||
location /uploads/ {
|
||||
alias /uploads/;
|
||||
root /;
|
||||
try_files $uri @uploads_bucket;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header Content-Disposition "inline" always;
|
||||
add_header Content-Security-Policy "default-src 'none'; img-src 'self'; style-src 'none'; script-src 'none'" always;
|
||||
}
|
||||
|
||||
location @uploads_bucket {
|
||||
rewrite ^/uploads/(.*)$ /$1 break;
|
||||
proxy_pass $upstream_garage_web;
|
||||
proxy_set_header Host uploads.web.garage;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header Content-Disposition "inline" always;
|
||||
add_header Content-Security-Policy "default-src 'none'; img-src 'self'; style-src 'none'; script-src 'none'" always;
|
||||
|
||||
Reference in New Issue
Block a user