-
Notifications
You must be signed in to change notification settings - Fork 7
fix SSE GET panic on HTTP-only backends #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a panic that occurs when HTTP-only backends receive SSE GET requests by adding a configuration flag to reject such requests before they reach the backend.
Key changes:
- Added
--http-streaming-onlyCLI flag andHTTP_STREAMING_ONLYenvironment variable to configure SSE rejection - Modified proxy routing to detect and reject SSE GET requests with HTTP 405 when streaming-only mode is enabled
- Added test coverage to verify SSE requests are rejected and backends are not called in streaming-only mode
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| main.go | Added httpStreamingOnly boolean flag with CLI and environment variable support, passed to the Run function |
| pkg/mcp-proxy/main.go | Updated Run function signature to accept httpStreamingOnly parameter and pass it to ProxyRouter |
| pkg/proxy/proxy.go | Added httpStreamingOnly field to ProxyRouter struct, implemented SSE detection logic, and added rejection before proxying |
| pkg/proxy/proxy_test.go | Updated existing test to pass new httpStreamingOnly parameter and added new test to verify SSE rejection behavior |
| docs/docs/configuration.md | Added documentation for the new --http-streaming-only flag in the Proxy Options table |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…nly mode that returns HTTP 405
cdbc961 to
04e18c2
Compare
- isSSEGetRequest now strips media type parameters before matching, so headers like text/event-stream; charset=utf-8 or with q-values are handled. - Expanded TestProxyRouter_HTTPStreamingOnlyRejectsSSE to cover parameterized Accept headers, multiple values, q-values, and to ensure POST + Accept: text/event-stream still passes through to the backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Type of Change
Related Issues
Fixes the SSE GET panic seen when proxying an HTTP-only backend (#103).