-
Notifications
You must be signed in to change notification settings - Fork 878
Description
Hi,
To be honest, I am not sure if this really is a bug report, or a question or a discussion.
I am using http-proxy-middleware to proxy requests from an Angular app to a rest service. It was working fine when I had this setup in a kubernetes environment. However, I recently tried to move it to Azure App Services, but when my web app tries to invoke the rest service through the proxy, I get a 403 forbidden. However, I am able to hit that rest service directly using a browser and Postman.
Express: 4.17.1
http-proxy-middleware: 1.0.3
This is my code for the middleware:
// Note that the source (web app) has the same domain, i.e. mywebapp.azurewebsites.net,
// so I don't think it's a CORS issue.
let tgt= 'https://mytarget.azurewebsites.net';
let src = '/mysource';
app.use(src, createProxyMiddleware({target: tgt, logLevel: 'debug', xfwd: false, changeOrigin: false}));
Note: I don't see any debug messages, even though logLevel is debug
I have tried various combinations of xfwd, changeOrigin, http vs https, etc.
The reason why I am submitting this issue, is because I read this post:
https://docs.microsoft.com/en-us/answers/questions/204366/azure-app-serivice-nodejs-proxy-403.html
In that post, he has the same issue as me. In a comment, he mentions:
"...but it seems like the problem is with the proxy implementation I'm using (http-proxy-middleware).
To resolve it I've created my own proxy functionality which do not have problems with 403 error."
So, I can try to write my own proxy, but I'd rather try to get this working if possible. I don't know if it's a configuration issue, or a code issue.
Any thoughts?
Thanks,
Brett