feat(proxy): preserve original Host header by default #1

Merged
james.oates merged 5 commits from feat/preserve-host-header into main 2026-06-12 16:07:01 +00:00
Owner

Summary

  • Changes proxy_http to forward the original client Host header to the backend by default, instead of letting reqwest substitute the backend hostname
  • Adds a rewrite_host boolean per-service escape hatch (default false) for any backend that needs the old behaviour
  • Adds migration 006_service_rewrite_host.sql

Motivation

AWS Signature V4 includes Host in the signed headers. When a client signs a request with Host: s3.oates.ws and the proxy forwards it with Host: minio:9000, MinIO rejects it with SignatureDoesNotMatch. The same issue affects cookie domain matching and redirect URL generation.

The existing WebSocket path (proxy_websocket) already preserves the original Host — this brings HTTP into line with the same behaviour, and with nginx's recommended proxy_set_header Host $host practice.

Usage

Default (no change needed for most services):

[[services]]
name = "minio-api"
target_host = "minio"
target_port = 9000
routing_hosts = ["s3.oates.ws"]
routing_paths = ["/*"]

Opt out (rewrite to backend hostname):

[[services]]
name = "some-service"
rewrite_host = true
...
## Summary - Changes `proxy_http` to forward the original client `Host` header to the backend by default, instead of letting reqwest substitute the backend hostname - Adds a `rewrite_host` boolean per-service escape hatch (default `false`) for any backend that needs the old behaviour - Adds migration `006_service_rewrite_host.sql` ## Motivation AWS Signature V4 includes `Host` in the signed headers. When a client signs a request with `Host: s3.oates.ws` and the proxy forwards it with `Host: minio:9000`, MinIO rejects it with `SignatureDoesNotMatch`. The same issue affects cookie domain matching and redirect URL generation. The existing WebSocket path (`proxy_websocket`) already preserves the original Host — this brings HTTP into line with the same behaviour, and with nginx's recommended `proxy_set_header Host $host` practice. ## Usage Default (no change needed for most services): ```toml [[services]] name = "minio-api" target_host = "minio" target_port = 9000 routing_hosts = ["s3.oates.ws"] routing_paths = ["/*"] ``` Opt out (rewrite to backend hostname): ```toml [[services]] name = "some-service" rewrite_host = true ... ```
james.oates deleted branch feat/preserve-host-header 2026-06-12 16:07:01 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
IsoHex/edge-router!1
No description provided.