8000 fix(server): let MCP work behind a proxy on the same host by kvaps · Pull Request #295 · aenix-io/aeman · GitHub
[go: up one dir, main page]

Skip to content

fix(server): let MCP work behind a proxy on the same host - #295

Merged
kvaps merged 1 commit into
mainfrom
fix/mcp-behind-local-proxy
Nov 6, 2026
Merged

kvaps merged 1 commit into
mainfrom
fix/mcp-behind-local-proxy

Conversation

@kvaps
@kvaps kvaps commented Nov 6, 2026
Copy link
Copy Markdown
Member

Behind a proxy on the same host (cloudflared, Caddy, a sidecar) every request reaches aeman on a loopback address with the public Host. The MCP SDK's DNS-rebinding guard answers that with 403 invalid Host header, so a client finishes the OAuth flow and then gets refused on every call. We hit this running prod on a laptop with cloudflared pointing at 127.0.0.1.

In OAuth mode /mcp already sits behind the bearer gate, and a rebinding page has no token to send, so the guard is turned off there. Requests without a token still get the 401 with the resource metadata.

Pinned as G84, with a test that sends an initialize through a loopback address with the public Host.

Behind cloudflared, Caddy or a sidecar every request reaches aeman on
a loopback address with the public Host, which the MCP SDK's
DNS-rebinding guard answers with 403. Clients got a token and then a
refusal on every call. /mcp is behind the bearer gate in OAuth mode,
so turn the guard off there.

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@kvaps
kvaps marked this pull request as ready for review November 6, 2026 18:41
@kvaps
kvaps merged commit 1ae2c85 into main Nov 6, 2026
2 checks 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

0