Apps behind a proxy that build absolute links or pick a virtual host by name need the original host name.
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme;
}
By default nginx sends Host: $proxy_host, which is the address written in proxy_pass, so the backend sees 127.0.0.1:8080. $host forwards the name the client asked for, and $http_host also keeps the port. X-Forwarded-Proto tells the app whether the visitor used HTTP or HTTPS, which prevents redirect loops. The app has to be configured to trust these headers from the proxy.
Further reading: ngx_http_proxy_module: proxy_set_header
Going deeper: Guide: fix a 502 Bad Gateway in Nginx Proxy Manager, with a checklist that finds the cause