I'm creating Flask API's on Windows. I'm using waitress as WSGI and it's hosted at a Windows server machine. I want to reverse proxy in order to have multiple ports with the same service (since the service take a bit of time like 6 seconds). I'm already using multi-threading but I really need to reverse proxy that. I created a python.conf file:
upstream flask_api {
server localhost:8000;
server localhost:5000;
server localhost:5001;
}
server {
listen 80;
location /service {
proxy_pass "http://flask_api/service";
}
}
where I'm simply trying to be able to access multiple ports when localhost/service is requested, the localhosts are already running. I've read some tutorials but still get error 404 when I try localhost/service (same error if I type anything after / that I didn't specify). Because of that I think the python.conf file is not being included at the nginx.conf file. How can I do that on Windows? I wrote :
include servers/*;
include C:\Users\Gabriel\loadbalancer\python.conf;
at the end of http{ } in nginx.conf.
It kind of worked when I erased the entire nginx.config file and rewrote it directly, that's how it looks now:
events { }
http {
upstream flask_api {
server localhost:8000;
server localhost:5000;
server localhost:5001;
}
server {
listen 80;
location /service {
proxy_pass "http://flask_api/service";
}
}
}
The ports are just returning "serving on port 'x'" so when I make a browser request it shows me the message. But when I refresh it the request never end, but once I stop this frozen request and make another one it works perfectly.