Skip to content

Conversation

@majiayu000
Copy link

Fixes #687

Changes

  • Strip leading / from endpoint path before URL resolution to preserve base URL's path prefix
  • Add test for reverse proxy scenario with path-based routing

When connecting to an SSE server behind a reverse proxy with path-based
routing, the client was incorrectly dropping the path prefix when
resolving the message endpoint. This happened because URL resolution of
an absolute path (starting with "/") replaces the entire existing path.

The fix converts absolute paths to relative paths by stripping the
leading "/" before resolution. This ensures the base URL's path prefix
is preserved during relative URL resolution.

Fixes modelcontextprotocol#687

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: majiayu000 <1835304752@qq.com>
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.

SSEClientTransport drops path prefix when endpoint URL is not on the HTTP root (similar to python-sdk#563)

1 participant