express-http-proxy is not passing req.user in proxied service nodejs

70 Views Asked by At

In nodejs created a gateway that proxies the apis based on some conditions. The gateway also checks the headers in token and if validated then set the req.user

Here is the proxy code

proxy(host) {
        // call proxy middleware with request option  
        return (req, res, next) => {
            let reqBodyEncoding;
            let reqAsBuffer = false;
            let parseReqBody = true;
             
            return default_proxy(host, {
                reqAsBuffer,
                reqBodyEncoding,
                parseReqBody,
            })(req, res, next);
        }
    }

now on my proxied service I am not getting req.user. What is the solution for this?

0

There are 0 best solutions below