Rocky not working on node@16
arminrosu opened this issue · 2 comments
arminrosu commented
Hello,
Not sure if this project is still maintained - but we were using it at and the upgrade to node@16 broke it.
const rocky = require('rocky')
const PORT = 8000
const URL = 'https://example.com'
const proxy = rocky()
proxy
.forward(URL)
.options({
debug: true,
forwardHost: true,
ignorePath: true,
secure: false,
ws: true,
})
.on('proxyReq', function (_proxyReq, req, _res, opts) {
console.log('Proxy request:', req.url, 'to', opts.target)
})
.on('proxyRes', function (_proxyRes, req, res) {
// never gets here
console.log('Proxy response:', req.url, 'with status', res.statusCode)
})
proxy.routeAll()
proxy.listen(PORT)
console.log(`Server running on :${PORT}`)
node index.js
Any request results in an ERR_EMPTY_RESPONSE
. Whereas on node <= 14 it works without a hitch.
Node versions affected:
- 16.0.0
- 16.13.1
Rocky Version:
- 0.4.16
Working on node@14
Hope that helps others too.
h2non commented
Hello! Rocky is not maintained anymore, I would recommend using http-proxy
instead, or you might try forking and upgrading rocky dependencies, I suspect this has to do with http-proxy
.