Commit 0fd9535
fix(nginx): use real client scheme for auth redirect behind proxy
Behind a TLS-terminating proxy (e.g. Cloudflare) the origin connection
may be plain HTTP, so $scheme is http and the login redirect points to
http://, which the proxy upgrades back to https, causing a redirect loop.
Derive $real_scheme from X-Forwarded-Proto when present and fall back to
$scheme for direct connections, then use it in the login redirect and the
upstream X-Forwarded-Proto header.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 974524d commit 0fd9535
1 file changed
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
10 | 18 | | |
11 | 19 | | |
12 | 20 | | |
| |||
39 | 47 | | |
40 | 48 | | |
41 | 49 | | |
42 | | - | |
| 50 | + | |
43 | 51 | | |
44 | 52 | | |
45 | 53 | | |
| |||
53 | 61 | | |
54 | 62 | | |
55 | 63 | | |
56 | | - | |
| 64 | + | |
57 | 65 | | |
58 | 66 | | |
59 | 67 | | |
| |||
0 commit comments