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

July 16, 2018 302 views
Nginx Node.js Ubuntu 16.04

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?

1 comment
1 Answer

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

Have another answer? Share your knowledge.