For some reason, my Node.js app running on 127.0.0.1:8081
requires /
.
If I start with this, BOTH /
and /projectb
are able to load the page.
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /projectb {
proxy_pass http://127.0.0.1:8081/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
When I change it to this, /projectb
is no longer able to fully load the page. When I look at the network tab, some (but not all) requests fail, for example some images, .js, some wrong endpoints.
server {
listen 80;
location /somethingelse {
proxy_pass http://127.0.0.1:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /projectb { # I'd expect this to still work.
proxy_pass http://127.0.0.1:8081/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
To summarize, it works when I hit the port directly 123.456.78.910:8081
, and when I have BOTH /
and /projectb
proxy to http://127.0.0.1:8081/
, and when I proxy to /
by itself, but not when I proxy to /projectb
by itself.
Why might this be the case?