Open pablote opened 5 years ago
Guys, any progress with this issue?
@pablote and @Doc999tor I have a fix for this in #1650 however it may not be merged or may take some time to get merged based on the activity in this repo. I found a temporary solution which works for me: instead of setting the proxyTimeout
option you can set the timeout manually yourself by adding a proxyReq
handler:
proxy.on('proxyReq', (proxyReq) => {
proxyReq.setTimeout(1000, () => {
const timeoutError = new Error('The proxy request timed out');
timeoutError.code = 'ETIMEDOUT';
proxyReq.destroy(timeoutError);
});
});
I'm currently proxying requests like this:
If the upstream server takes too long, the callback is run with the following error:
Would it make sense to get a timeout specific error? so I can, if I chose to do so, return a specific timeout error like 504?