[英]How to prevent express from sending “502 Bad Gateway” when I don't answer a request?
For a special use case with an express 4 server (forcing a client, that doesn't respond to 503 status code repeat a request) I need to not respond to a client request at all. 对于具有快速4服务器的特殊用例(强制客户端,不响应503状态代码重复请求)我根本不需要响应客户端请求。
But Express sends a 502 Bad Gateway after apr. 但是Express在apr之后发送了一个502 Bad Gateway。 2 minutes, when I just omit to send a result.
2分钟,我只是省略发送结果。 How can I achieve this?
我怎样才能做到这一点?
I tried to catch the timeout, but that doesn't help: 我试图抓住超时,但这没有帮助:
app.use((req, res, next) => {
if (!req.timedout) {
next();
return;
}
console.log('Timeout!')
});
Tell me if I didn't understand the question correctly... 告诉我,如果我没有正确理解这个问题......
You can use res.end();
你可以使用
res.end();
. 。 That will end the request.
这将结束请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.