I have a problem with oAuth redirect under nginx proxy. I have the google social login button on my website and locally it works well. When i upload my project online and i put it under nginx proxy it doesn't work anymore. When i click login the browser redirects me to localhost:3000/auth/google/callback instead of mywebpage.com/auth/google/callback telling me that that page doesn't exist.
I am aware of this question: Nginx proxy with Google OAuth 2.0 and i tried to use the fixes they suggest but they didn't work because i don't run Meteor but NodeJS on Express with a Nginx Proxy.
The second solution they suggest is to use proxy_redirect but it doesn't seem to work. I have an oAuth with google but every time i click it(it's a browser redirect, not a popup) it redirects me to localhost:3000 which is the url behind the proxy.
I tried every possible configuration of proxy_redirect but it always redirects me there. This is my proxy part in nginx:
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_redirect http://localhost:3000 https://mywebsite.com;
}
Any suggestion?