NGINX: dispatch a request to multiple endpoints

1

For a test environment, I need to dispatch a single request to multiple endpoints (i.e I have to duplicate the request). I would like to do so using only NGINX, but I am not sure that it is possible.

For my host, my configuration file looks like this:

server {
    server_name myserver.com;
}

server {
    listen 443 ssl;
    server_name myserver.com;

    ssl_certificate      ssl/cert.pem;
    ssl_certificate_key  ssl/key.pem;

    proxy_set_header        Host myserver.com;
    proxy_ssl_name          myserver.com;
    proxy_ssl_server_name   on;

    location  / {
                proxy_pass https://server1/;
            }

I tried to use multiple proxy_pass tags, like this:

location  / {
                    proxy_pass https://server1/;
                    proxy_pass https://server2/;
                    proxy_pass https://server3/;
                }

Of course I did not really expected it to work, but I think that it will help you to understand what I am trying to achieve.

So my question is: is it possible to achieve this with NGINX?

Matthieu.V

Posted 2019-05-13T10:04:15.847

Reputation: 13

Answers

0

What you want to do is called HTTP shadowing. Nginx might not allow it, but GoReplay does.

MikaDo-

Posted 2019-05-13T10:04:15.847

Reputation: 101

1Not really what I expected, but thank you for the advice. – Matthieu.V – 2019-05-15T11:17:42.380