You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes, for a certan combination of method, path, header, I would like to bounce back the request BEFORE it's forwarded to the server.
I'm no sure where to create this response object, and how to return it so that the request never reaches the server.
I.e.
constproxy=require('express-http-proxy');constapp=require('express')();constport=5000app.use(proxy('localhost:9200',{https: true,preserveHostHdr: true,parseReqBody: false,proxyErrorHandler: function(err,res,next){if(err)console.log("ERROR! ",err)next(err);},proxyReqPathResolver: function(req){console.log("> "+req.method+" ",req.url)returnreq.url},proxyReqOptDecorator: function(proxyReqOpts,srcReq){// letting self signed ssl cert go throughproxyReqOpts.rejectUnauthorized=falseif(srcReq.path.indexOf("siem")>=0&&srcReq.method=='PUT'&&srcReq.statusCode==400){console.log("responding immediately with a 200...")// return ???????? <--- I don't want this request to reach the server!}returnproxyReqOpts;}}));app.listen(port,()=>{console.log(`Example app listening at http://localhost:${port}`)})
The text was updated successfully, but these errors were encountered:
Sometimes, for a certan combination of method, path, header, I would like to bounce back the request BEFORE it's forwarded to the server.
I'm no sure where to create this response object, and how to return it so that the request never reaches the server.
I.e.
The text was updated successfully, but these errors were encountered: