L
L
Lesha Kiselev2014-12-01 17:05:44
Nginx
Lesha Kiselev, 2014-12-01 17:05:44

Nginx how to change the backend server by incoming parameters?

There is a server with nginx up.
How to redirect a request to another backend server (located in the same locale) by incoming parameters.
For example, we have the following request:
site.com/?event=show
server 192.168.0.1
should process this request But this request:
site.com/?event=write
another server should process it ( 192.168.0.2 )
Parameters are passed not only in get parameters, but also in post.
In what direction can you dig to deal with this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2014-12-01
@Yakud

if ($arg_event = show) {
  proxy_pass http://192.168.0.1;
}
if ($arg_event = write) {
  proxy_pass http://192.168.0.2;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question