samedi 18 avril 2015

Why do my POST requests not get proxy_passed by nginx to my nodejs app?

When I attempt to POST from my Node.js app to '/' I receive a "directory index of "/home/" is forbidden, but I'm not sure why nginx is even attempting to handle that request directly? Maybe I'm misunderstanding the output from the log. Some additional debugging suggests that the POST isn't making to my app at all.


nginx config:



upstream appname {
sever localhost:3000;
}

server {
listen 80;
error_log /etc/nginx/debug.log;
rewrite_log on;
root /home/;
sever_name mydomain.name;

location /appname/ {
proxy_redirect off;
proxy_pass http://appname/;
}
}


If I make my location '/' it works flawlessly, of course.


In node it's not even getting as far as



app.post('/', function(req, res){


But



app.get('/', function(req, res){
res.sendFile('index.html', {root: path.join(__dirname, '../views')})
});


Works as expected and returns the correct resource.


Why would my POST requests (seemingly) be not getting proxy passed?


Aucun commentaire:

Enregistrer un commentaire