'webpack devServer proxy doesn't catch my request
I have a UI app on http://localhost:8050/ and api server on http://foo.local.bar.com.
I logged in to the server directly, but I need the UI to send to cookie to the server too when I fetch GET method http://foo.local.bar.com/myapi/api/goo/maa .
In my config json I added devServer with proxy but it doesn't seem to work :
devServer: {
proxy: {
'/api/*': {
"target": "http://foo.local.bar.com",
logLevel: 'debug',
secure: false,
changeOrigin: true,
withCredentials: true,
cookieDomainRewrite: "localhost",
onProxyReq: proxyReq => {
console.log("onProxyReq 1 !!!!!!!!") // I don't can't see any console log, so I also think the proxy doesn't "catch" my request...
proxyReq.setHeader("Cookie", ".MYCOOKIE=123445");
console.log("onProxyReq 2 !!!!!!!!", proxyReq)
}
}
}
},
But I still get "Authorization has been denied for this request." 401 error.
Any ideas? I tried, like, everything...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
