Node App routes work but POST data doesn't come through

February 22, 2019 247 views
Ubuntu 18.04 Nginx Node.js

I can’t seem to get post data to come through on my newly setup server. Sorry I am a newbie at this. This is my setup for nginx. I can reach the server an not get an error on the endpoints but data somehow doesn’t come through works fine locally.

Could it be something with the firewals?

map $httpupgrade $connectionupgrade {
default upgrade;
“ close;
}

server {

listen 80;
listen [::]:80;
server_name mydomain.com www.mydomain.com;

location / {

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;
}

}

1 Answer

Greetings!

I do not personally write code with this language, so it may be possible that someone else can come along and provide a more detailed answer than myself. However, I do feel qualified to answer at a high level.

If Nginx captures the POST data and is configured to reverse proxy to the node app, then I believe you can safely identify the node app as the point that needs to be reviewed. If you can code in verbose logging to the app, this may allow you to see what is coming in and how it is interpreting it. It won’t be firewall, so you can at least narrow down the stage at which this occurs.

If it never gets caught or logged by Nginx, then I would assume the browser is not sending the data at all, and perhaps i would try either using curl or a different browser to test.

Jarland

Have another answer? Share your knowledge.