I switched from using Nodejs as both a reverse proxy and a backend server, to just using it as the backend server for my api, and decided to use Nginx as a reverse proxy instead.
(note: I've never used Nginx before so it's all new to me). When i switched to Nginx, cookie authentication stopped working, i.e. user does not get logged in, so I'm trying to figure out what header I'm not setting in the conf file, so that cookie gets sent from client to reverse proxy to backend api (seems like cookie doesn't get forwarded to the backend?).
I had an issue like this when using node as a reverse proxy before switching to nginx as well, but then I solved it by editing the request library to include jars as follows:
let request = requests.defaults({jar: true});
Does something similar to this have to be done for nginx as well? If so what? Thanks
This is my nginx setup, to act as reverse proxy for /api routes:
server {
listen 8080;
server_name localhost;
location /api {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:3001;
}
via linas mnew
No comments:
Post a Comment