I got an app running in port 3000.
this app is working behind a reverse proxy such as:
server {
listen 80;
server_name myapp;
location / {
proxy_pass http://127.0.0.1:3000;
}
}
so, everytime I access to my site, it will serve to localhost the content from port 3000, and it's working ok.
The problem is after the auth0 authentication, when the user is authenticated it keeps redirecting to localhost:3000/#, how can I make it work to localhost?
this is my Nginx config file:
server {
listen 80;
server_name myapp;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
location /generic_oauth/ {
proxy_pass http://127.0.0.1:3000;
}
}
callback is localhost/login/generic_oauth
my auth0 settings callback is: http://localhost:3000/login/generic_oauth
if I change my auth0 callback to http://localhost/login/generic_oauth
got the error:
the callback must be http://localhost:3000/login/generic_oauth
sorry for my bad english
The application has to know what domain name to use on the URLs it issues. nginx may also need to do some rewriting.
Add an X-Forwarded-Host header, and potentially a proxy_redirect directive, as per instructions here
https://www.nginx.com/resources/wiki/start/topics/examples/likeapache/