NginX : Route user request to backend
- by xperator
The goal is to have NginX webserver act as a very basic & simple load balancer/fail-over. But instead of fetching static files from backend and serving it to user, I just want to route/redirect user request to one of the back end servers.
upstream backend {
server server1.example.com:80;
server server2.example.com:80;
server server3.example.com:80;
}
location / {
proxy_pass http://backend;
}
Instead of :
User request (example.com/test.file) NginX LB Backend NginX LB
User
I want to have :
User request (example.com/test.file) NginX LB Backend User
Is this even possible with NginX ? If not then How can I achieve this goal.
UPDATE 1: Is there a way to use rewrite directive with backend upstream ?
UPDATE 2: It's not really necessary to use NginX. I just want to have a direct reply from backend to user.