Commit c43599a
Forward client Host (with port) and scheme in reverse-proxy templates
The reverse-proxy templates set `proxy_set_header Host $host`, which
normalises the Host header and drops any non-standard port, and they
never forward the request scheme. Downstream apps that build absolute
URLs from the request (e.g. Drupal, Next.js) therefore emit URLs with
the wrong port and scheme when the proxy is published on a non-standard
host port such as https://app.local:37103 — the generated links point at
https://app.local (port 443) and 404.
Use $http_host to preserve the exact Host the client sent (including the
port), and forward X-Forwarded-Proto $scheme so the backend knows the
public scheme. Both listen ports (80/443) share one server block, so
$scheme is correct for either. Applied to all four reverse-proxy
variants (proxy, nextjs, storybook, vite); the drupal variant already
passes HTTP_HOST/HTTPS via fastcgi_params.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent dfb72dc commit c43599a
4 files changed
Lines changed: 14 additions & 7 deletions
File tree
- context
- nextjs/etc/nginx/templates
- proxy/etc/nginx/templates
- storybook/etc/nginx/templates
- vite/etc/nginx/templates
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | | - | |
| 41 | + | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
0 commit comments