I need to duplicate/mirror the traffic comming to my server/resource.
I mean, I have server A and B and N (nginx) as webserver.
All the traffic comming to N/resource --> redirect to both A and B
Is it possible?
I need to duplicate/mirror the traffic comming to my server/resource.
I mean, I have server A and B and N (nginx) as webserver.
All the traffic comming to N/resource --> redirect to both A and B
Is it possible?
Nginx now has an http mirror module. Documentation is at https://nginx.org/en/docs/http/ngx_http_mirror_module.html
Example configuration from the documentation:
location / {
mirror /mirror;
proxy_pass http://backend;
}
location /mirror {
internal;
proxy_pass http://test_backend$request_uri;
}
Here is new feature from nginx (1.13.4): http://nginx.org/en/docs/http/ngx_http_mirror_module.html#mirror
The ngx_http_mirror_module module (1.13.4) implements mirroring of an original request by creating background mirror subrequests. Responses to mirror subrequests are ignored.
Based on their README It looks that GOR could help you solving your problem.
I never used it before, just stumbled upon it this week, so good luck!
you cannot mirror requests with NGINX but the request is available as a variable. You could use Lua scripting to send that variable to a third party server as a sub request though. http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request
After digging and digging I found a solution. You can see it here Copy and deliver a request to another nginx server for real traffic testing by @scari
Just thought I should mention it here to ease the search for other people. On my setup I didn't use uwsgi - instead I wanted to duplicate every incoming request to an additional servers (in addition to the backbones servers that was load balanced already.
Hope it will help,
Liron