I have certain cases in which I have some security checks in modifying the path of the original http request. Those security checks might fail and I do a :
proxy.on('proxyReq', function(proxyReq, req, res, options) { res.status(403).send("You are not permitted to access...");
This type of shortcut works in middleware, but I've noticed that node-http-proxy will still attempt to call the target url and write the proxy response to the initial response.
How to short-circuit the response in a 'proxyReq/proxyRes' event?
Hello,
I have certain cases in which I have some security checks in modifying the path of the original http request. Those security checks might fail and I do a :
proxy.on('proxyReq', function(proxyReq, req, res, options) { res.status(403).send("You are not permitted to access...");
This type of shortcut works in middleware, but I've noticed that node-http-proxy will still attempt to call the target url and write the proxy response to the initial response.
How to short-circuit the
response
in a 'proxyReq/proxyRes' event?