I need to route every request to 2 upstreams one after another (1st auth-server
, 2nd misc-server
). 1st upstream may or may not add headers and may/ may not alter request body.
Upstreams API can be POST/GET
Can we do something like below with nginx:
upstream auth-server {
server localhost:8800 weight=5;
}
upstream misc-server {
server localhost:8800 weight=5;
}
server {
location /misc {
proxy_pass http://auth-server/misc/auth/pre; #1st route to this
}
location /misc {
proxy_pass http://misc-server/misc; #2nd route to this
}
}
The reason I'm trying to achieve this is for request validation by 1st upstream ie auth-server
before actually routing request to destination upstream ie misc-server
. Is this advisable?