How to prevent express from sending "502 Bad Gateway" when I do not answer the request?

For special use with explicit server 4 (forcing a client that does not respond to the status code 503, repeat the request), I do not need to respond to the client’s request at all.

But Express sends 502 Bad Gateway after April. 2 minutes when I just skip to send the result. How can I achieve this?

I tried to catch the timeout, but this does not help:

app.use((req, res, next) => {
  if (!req.timedout) {
    next();
    return;
  }

  console.log('Timeout!')
});
+4
source share
1 answer

Tell me if I understood the question correctly ...

You can use res.end();. This will complete the request.

0
source

Source: https://habr.com/ru/post/1689964/


All Articles