What I pretty much want to achieve is add user data, or any data, into my requests to one of my services but like I did in the code below it is not adding to my proxyRequest when sent to my service. Any one know why and how can I achieve that?
app.use('/platform',
jwtMiddleware,
(req, res, next) => {console.log(req.user, req.method), next()},
createProxyMiddleware({
target: `http://localhost:8000`,
auth: false,
changeOrigin: true,
pathRewrite: {
[`^/platform`]: '',
},
onProxyReq: function onProxyReq(proxyReq, req, res) {
proxyReq.user = req.user
}
})
);