Question

Ngnix response body is empty even though the nodejs api returns the correct body without ngnix

Things I changed from the default config:

server_name www.domain.com domain.com
location / {
    proxy_pass http://localhost:8080;
    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;
}
location /api {
    proxy_pass http://localhost:8000;
    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;
}

The response is json if it matters at all. I honestly have no idea what to do. Is there maybe some kind of size limit?

Subscribe
Share

Is it possible that location gets automatically appended to the proxy_pass


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

The location /api automatically appends the /api to the http://localhost:8000. That was my problem for anyone having the same problem.