Closed kacperzuk closed 8 years ago
Will take a look. Thanks for reporting.
I've fixed an with retry logic. Update rocky
to v0.4.10
and try with the following code:
const http = require('http')
const proxy = require('rocky')()
proxy
.get('/*')
.forward('http://127.0.0.1:3001')
.retry({})
.on('proxy:retry', function (err, req) {
console.log('Retry request...')
})
proxy.listen(3000)
var calls = 0
http.createServer(function (req, res) {
calls += 1
if (calls === 4) {
return res.end('success')
}
res.writeHead(500)
res.write('error')
res.end()
}).listen(3001)
// Test requests
http.get('http://localhost:3000', function (res) {
console.log('Response from target server:', res.statusCode)
res.on('data', function (chunk) {
console.log('Data:', chunk)
})
})
Everything works ok now, thank you :)
I'm not sure how to describe that, so here's a test case:
I get this error when running it:
What is interesting, is that it stops crashing if I only remove line
res.write("test")
.Is there something I'm doing wrong?