Repository navigation
Add Via header to passed-through requests in Kestrel engine. Closes #1948 - #1950
Merged
Merged
Conversation
…otnet#1948 Restores the behavior from v3.3.1 (removed in the Kestrel migration): watched requests that no plugin answers get 'Via: <http-version> dev-proxy/<version>' appended after BeforeRequest, so it reaches the origin and response-phase plugins see it. Required by RFC 9110 section 7.6.3. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 558c5c5b-c2bd-4fab-bab2-51e635519d65
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused change matches the requested behavior, includes integration coverage, and has no identified blocking issues.
No open issues 🎉
What changed in this PR
Restores the Kestrel engine’s Via header for watched requests passed through to the origin, preserving existing values.
Changes:
- Appends the proxy’s HTTP and product versions after request plugins run.
- Adds integration tests for new and existing
Viaheaders.
| File | Description |
|---|---|
| DevProxy.Proxy.Kestrel/Internal/PluginPipeline.cs | Adds Via to passed-through requests. |
| DevProxy.Integration.Tests/PlainHttpIntegrationTests.cs | Tests header addition and preservation. |
| DevProxy.Integration.Tests/FakeOrigin.cs | Adds an endpoint that echoes Via values. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1948
The Kestrel engine stopped adding the
Viaheader to passed-through requests afterAddProxyHeaderwas removed in the Kestrel migration (#1854).This change restores the v3.3.1 behavior in
PluginPipeline: when a watched request isn't answered by a plugin, the pipeline appendsVia: <http-version> dev-proxy/<version>(for example,Via: 1.1 dev-proxy/4.0.0) afterBeforeRequestruns. The header reaches the origin, and response-phase plugins, like the recorder and.httpgenerator, see it too. An existingViavalue is preserved. This also follows RFC 9110 §7.6.3.Tests: added integration tests for the header being added and for appending to an existing
Via. All test suites pass.