Skip to content

Commit e3420f8

Browse files
committed
fix: add x-forwarded-proto header to internal whoami httpCall
Envoy automatically appends x-forwarded-for to all outgoing requests, including Lua httpCall subrequests. Synapse treats any request carrying x-forwarded-for as a forwarded client request and warns when x-forwarded-proto is absent, falling back to https assumption. The whoami lookup is an internal Envoy subrequest, not a proxied client request, so ideally it would carry neither forwarded header. However, x-forwarded-for cannot be suppressed from a Lua httpCall — Envoy adds it unconditionally. Overwriting x-forwarded-for with 127.0.0.1 would be semantically cleaner but would discard potentially useful origin info if Synapse ever uses it beyond this check. Adding x-forwarded-proto: https is the minimal fix: it completes the forwarded header pair, silences the warning, and keeps the request headers consistent without masking the original IP.
1 parent d7b413c commit e3420f8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

charts/synapse/scripts/synapse.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ local function lookup_whoami(request_handle, token, options)
167167
[":method"] = "GET",
168168
[":path"] = get_option(options, "whoami_path", "/_matrix/client/v3/account/whoami"),
169169
[":authority"] = authority,
170-
["authorization"] = "Bearer " .. token
170+
["authorization"] = "Bearer " .. token,
171+
["x-forwarded-proto"] = "https"
171172
},
172173
"",
173174
get_option(options, "timeout_ms", 5000)

0 commit comments

Comments
 (0)