I have one server that has several APIs running on it. One of them is users-DB
The following gets down to gunicorn just fine:
location /usersDB/ {
include proxy_params;
proxy_pass http://unix:/home/ubuntu/projects/UsersDB-api/app.sock;
}
Except when I try to access the usersDB API's /helloWorld route, and look in the logs at gunicorn.err I see:
GET /usersDB/helloWorld
I was hoping to see:
GET /helloWorld
Of course, gunicorn returns 404s and that is what I see in my browser. I've tried rewrite rules:
location /usersDB/ {
rewrite /usersDB/(.*) /$1 last;
include proxy_params;
proxy_pass http://unix:/home/ubuntu/projects/UsersDB-api/app.sock;
}
But the above results in the requests making their way to /var/www/htmlhelloWorld
instead of app.sock.
I know that if you use a url for the proxy_pass you just add a trailing /
, but I'm not sure what to do in the case of a sock file.
How do I get rid of the /usersDB/
suffix that is now included on all routes in nginx?
Use a separating :
. For example:
proxy_pass http://unix:/home/ubuntu/projects/UsersDB-api/app.sock:/;
See this document for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With