Remove http-proxy-node16, replace with lightweight inline proxy#7196
Remove http-proxy-node16, replace with lightweight inline proxy#7196ryancbahan wants to merge 1 commit into
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Add http-proxy.ts (~100 lines) implementing web() and ws() proxy methods using Node's built-in http/https modules. Handles HTTP request forwarding via pipe, and WebSocket upgrades via bidirectional socket piping with proper 101 Switching Protocols response. Includes 6 direct unit tests (GET/POST forwarding, header preservation, path forwarding, error callbacks for unreachable targets on both web and ws). Plus 8 existing integration tests via http-reverse-proxy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7008daf to
383b392
Compare
|
We detected some changes at Caution DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release. |
gonzaloriestra
left a comment
There was a problem hiding this comment.
I'm not sure about this change. I agree with replacing simple libraries with our own code, but this looks a bit complex (even if it's small)...
For example, some concerns by Claude that were apparently handled by the library:
- connection: 'close' on every proxied request — this disables keep-alive, which could add latency for repeated requests to the same backend during app dev. A battle-tested proxy library would handle connection pooling properly.
- Manual HTTP response construction in WS upgrade — writing raw
HTTP/1.1 101 Switching Protocols\r\n... strings is fragile. Edge cases around header formatting (multi-value headers, encoding) can cause subtle breakage. - No timeout handling — if a backend hangs, the proxy request will hang indefinitely.
|
@gonzaloriestra I hear you, but I think a simple proxy/reverse proxy is something node can do well and that we can manage. But I definitely want to ask for broader team perspective here. @byrichardpowell @dmerand @isaacroldan what do y'all think? If there's alignment that this is a good dep removal candidate, I'll harden the tests and ensure those cases you pointed out are derisked. Else, I'll close. |
|
Yeah, this one is not a clear candidate for removal imo. It seems like http-proxy-node16 hasn't had many updates in the last 24 months, so it's not really a maintenance sink. I also echo Gonzalo's concern about edge cases. Although I haven't looked into the practical implications of Gonzalo's points my instinct is to leave this one alone. |

Summary
http-proxy.ts(~100 lines) implementingweb()andws()proxy methods using Node's built-inhttp/httpsmoduleshttp-proxy-node16frompackages/app/package.jsonTophatting