node-http-proxy
node-http-proxy copied to clipboard
Un-catchable Malformed_HTTP_Response crash.
System and Environment Information:
- OS: debian bookworm
- Runtime: Bun 1.1.3
Details on the Issue: Periodically, my server will crash with the error along the lines of:
Malformed_HTTP_Response: Malformed_HTTP_Response fetching "http://192.168.0.9:8000/ports/list". For more information, pass `verbose: true` in the second argument to fetch()
path: "http://192.168.0.9:8000/ports/list"
I've tried using try...catch but this is an issue with the package.
Reproduction: Open up a Express server and add similar code to this:
var proxy = HTTPproxy.createProxyServer({ ws: true });
server.get("/ws/:node/*", function (req: Request, res: Response) {
let url = req.url.replace(`/ws/${req.params.node}/`, "");
req.url = url;
try {
proxy.web(req, res, {
target: "http://" + endpoints[req.params.node].split("@")[1],
});
} catch {}
});
At some point you'll encounter Malformed_HTTP_Response.
Note: I've looked at the code and couldnt find the use of fetch() anywhere, this could be an issue with a different package. I'm blaming this issue on this package for now though.