Score:0

How to make nginx receive and send data to both server1 and server2?

rs flag

I have nginx as reverse proxy. I want to send data to both server, not just one not load balancing (just send data that it receive from port 80 to server1 and then server2).

Server1 will be a web server and server2 is for logging request.

location /app2/ {
    proxy_bind 127.0.0.2;
    proxy_pass http://example.com/app2/;
}
Gerard H. Pille avatar
in flag
You'd need to develop a proxy that does just that. Do you have any idea what you'll do with the answer from the second server?
Score:0
in flag

This feels like a XY question. You specify that server2 is for logging?

I'd suggest using both servers for webserving AND logging, and then set some other process up to ingest those logs (logstash, elasticsearch, etc) and keep the clocks in synch with NTP.

This solution lets you expand horizontally with server3,4.... should the load require that.

Score:0
in flag

Another option is to move the "splitting" role to your ethernet switch instead of the proxy or webserver.

If you have admin access to your ethernet switch, check if it supports a MIRROR port, sometimes called a MONITOR port. This will clone all ethernet frames that enter/exits the physical port to your webserver, and replays it on the mirror port.

Attached to that monitor port would be some kind of sensor-host, capable of packet-dumping everything and logging what it sees. There are a fast number of software options available.

Main advantage of this is that the webserver/s and proxy are unaware and need no changes, and there is no load on those hosts.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.