Hi folks,
I have been stuck this issue for a long time now. Searches could not solve my issue hence posting here.
Please help.
I am using nginx as a load balancer and ngnix.conf looks like:
worker_processes 4;
events { worker_connections 1024; }
http {
upstream ab_backend {
server <IP1>:7000;
server <IP2>:7000 backup;
}
server {
listen 8000;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://ab_backend;
}
}
}
IP1 and IP2 are simple httpd docker containers. From another machine I am running ab tool. What I am observing is: When IP1 is up the http it responds to request from ab. Bring IP1 and backup IP2 starts to respond to al http requests.
starnge thing is when both IP1, IP2 are down the nginx server itself takes it up and responds to the http requests from ab. Is there a way to make nginx not behave this way?
what I am looking for is way to force http requests to be answered by only the upstream servers if none of them are reachable requests should get errors instead of giving out non bona fide responses.
I am testing using ab and httperf tool and saw the bahavior in both cases. Even when no upstreams are up test reports no Errors or dropped requests. Please help :)