PaulDotCom mailing list archives

Re: Apache route requests to two or more servers


From: Robin Wood <robin () digininja org>
Date: Wed, 13 Jul 2011 08:28:40 +0100

On 13 July 2011 04:01, Nick Baronian <nbaronian () gmail com> wrote:
If I understand what you are after correctly, I am sure some minor
mangling could do this.  If you just want to duplicate all incoming
webserver traffic, you could use iptables with the xtables tee to
mirror your webserver's port(s) to another Apache server.  If you only
want to mirror certain requests, I think you could achieve this by
having Apache listen on multiple ports, redirect calls using
mod_rewrite or whatever to the other listening webserver:port.  Have
this redirection happening in conjunction with iptables/tee forwarding
this other listening port out to your other Apache instance also.

Depending on your needs, I would think you would want to block the
responses from the second Apache server.  Chances are they would be
dropped by the requesting host but the host would probably still
receive them.  So depending on how silent you needed to be, I suggest
dropping all outbound responses using iptables or whatever.

If neither of these solutions work, perhaps fronting your Apache
server with Squid in a reverse proxy configuration.  It has been years
since I have played with it but I believe you can use Squid Redirector
or something like SquidGuard to redirect all or specific requests out
to multiple destinations.  But all this could be overkill and probably
a big pain, maybe just using something simple like Ruby Webrick
httpproxy.  Setup a listening service, forward/redirect and/or
duplicating certain requests would probably work too.  Have Webrick
forward requests to your primary Apache but also to your other Apache
instances.


I like all those ideas, the Squid proxy is probably a bit of overkill
but I'll definitely have a look at iptables and using Webrick
httpproxy, sounds obvious when you mention it and I wrote a very basic
proxy for test I was doing the other day so I can see how simple it
would be.

Thanks

Robin


Good luck,
Nick



On Tue, Jul 12, 2011 at 5:05 PM, Robin Wood <robin () digininja org> wrote:
Does anyone know if there is a way to get Apache to send a request to
multiple servers, possibly using something like mod_proxy, and specify
which one I want to take the response from.

I'm thinking of something like a replication system, take this request
and send it to the main server and also to a second and third server
as a backup. This isn't a replication service, I'm just using this as
an example.

Robin
_______________________________________________
Pauldotcom mailing list
Pauldotcom () mail pauldotcom com
http://mail.pauldotcom.com/cgi-bin/mailman/listinfo/pauldotcom
Main Web Site: http://pauldotcom.com

_______________________________________________
Pauldotcom mailing list
Pauldotcom () mail pauldotcom com
http://mail.pauldotcom.com/cgi-bin/mailman/listinfo/pauldotcom
Main Web Site: http://pauldotcom.com

_______________________________________________
Pauldotcom mailing list
Pauldotcom () mail pauldotcom com
http://mail.pauldotcom.com/cgi-bin/mailman/listinfo/pauldotcom
Main Web Site: http://pauldotcom.com


Current thread: