Nginx Config / Admin not loading on local domain

I’m using Strapi with Nginx, and I have a reverse proxy configuration set up like this:

nginx
location /admin {
proxy_pass http://127.0.0.1:1337/;
proxy_set_header host $host;
proxy_set_header x-real-ip $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header x-forwarded-proto $scheme;
}
When I access http://mydomain.local/admin, I get redirected to http://mydomain.local/admin/auth/login, and after logging in, I see in the network inspector that the same response is returned as if I were using localhost:1337/admin. A JWT cookie is correctly set in the browser, but I still get an error saying “An error occurred”, and the content doesn’t load.

If I access Strapi directly using http://localhost:1337/admin everything works perfectly.

Any guidance?

This topic has been created from a Discord post (1293199075516354683) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

I’m using Strapi with Nginx, and I have a reverse proxy configuration set up like this:

nginx
location /admin {
proxy_pass http://127.0.0.1:1337/;
proxy_set_header host $host;
proxy_set_header x-real-ip $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header x-forwarded-proto $scheme;
}
When I access http://mydomain.local/admin, I get redirected to http://mydomain.local/admin/auth/login, and after logging in, I see in the network inspector that the same response is returned as if I were using localhost:1337/admin. A JWT cookie is correctly set in the browser, but I still get an error saying “An error occurred”, and the content doesn’t load.

If I access Strapi directly using http://localhost:1337/admin everything works perfectly.

Any guidance?