How to correctly configure Nginx for Node.js REST API? How to correctly configure Nginx for Node.js REST API? nginx nginx

How to correctly configure Nginx for Node.js REST API?


Notice that you're requesting this:

https://example.com/api/users

But the error says this:

Cannot GET /users

So the /api prefix is being stripped off the request path before being passed to your Node server.

Which is done by this line:

rewrite ^/api/?(.*) /$1 break;

Solution: remove that line.