Add channel proxy plug with endpoint routing#4418
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## channels #4418 +/- ##
=========================================
Coverage 89.31% 89.31%
=========================================
Files 430 431 +1
Lines 20103 20121 +18
=========================================
+ Hits 17955 17972 +17
- Misses 2148 2149 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Wire Weir as a path dependency and create ChannelProxyPlug that intercepts /channels/:id/*path requests before Plug.Parsers, looks up the channel, sets proxy headers, and forwards to the sink via Weir.proxy/2 with streaming.
#4401) - Validate sink_url with Validators.validate_url/2 in Channel changeset to reject non-http(s) URLs at creation time rather than at proxy time - Remove manual x-request-id handling from ChannelProxyPlug since Weir now injects it into upstream requests automatically - Add path traversal tests documenting that ".." as channel_id fails UUID validation (404) and ".." in subpaths is forwarded as-is
8269b4e to
f42efd9
Compare
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.
Description
This PR adds the channel proxy plug that routes incoming HTTP requests to channel sink URLs via the Weir streaming proxy.
ChannelProxyPlugmounted at/channels/:channel_idin the endpointsink_urlon channel changeset (must be absolute HTTP/HTTPS URL)weirdependency (GitHub source, withWEIR_PATHlocal override)Closes #4401
Validation steps
mix test test/lightning_web/plugs/channel_proxy_plug_test.exsmix test test/lightning/channels_test.exsAdditional notes for the reviewer
WEIR_PATHenv var for local development.AI Usage
Pre-submission checklist