Skip to content

Feat/custom s3 headers#16

Merged
ProjectInitiative merged 8 commits into
mainfrom
feat/custom-s3-headers
May 10, 2026
Merged

Feat/custom s3 headers#16
ProjectInitiative merged 8 commits into
mainfrom
feat/custom-s3-headers

Conversation

@ProjectInitiative
Copy link
Copy Markdown
Owner

No description provided.

… etc.)

Add three ways to set extra HTTP headers on every S3 request, all of
which are merged together:

- [s3.extra_headers] in TOML config for non-secret inline headers
- LOFT_EXTRA_HEADER_* env vars (underscores map to hyphens)
- extraHeadersFile NixOS option for file-based secrets (sops-nix/agenix)

Headers are injected via an SDK interceptor at the modify_before_transmit
phase (after SigV4 signing), so auth proxy headers are consumed by the
proxy before reaching the S3 endpoint without causing signature mismatches.
Dedicated NixOS VM test that sets up nginx as an auth proxy in front of
Garage requiring a X-Loft-Auth header on port 3902. Tests all three
header mechanisms:

- inline [s3.extra_headers] config
- LOFT_EXTRA_HEADER_* env vars
- file-based (simulating NixOS extraHeadersFile)
- negative test: no headers, nginx returns 403, paths not uploaded
The nginx auth proxy was changing the Host header when forwarding to
Garage, breaking the AWS SigV4 signature validation. Added
proxy_set_header Host $host:$server_port to preserve the original
endpoint host:port so signatures match.
@ProjectInitiative ProjectInitiative merged commit 0a2b058 into main May 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant