[Twisted-Python] Re: Proxy server in front of two web sites

Marcin Kasperski Marcin.Kasperski at softax.com.pl
Mon Oct 29 09:37:05 EDT 2007

"Stefan Arentz" <stefan.arentz at gmail.com> writes:

> I'm looking at implementing a solution for the following problem: I
> have a setup with two web servers. Each contains the same directory
> structure but not the same files. Using a proxy server in front of
> these two I would like to merge them into one. So the proxy would
> first hit server A and if A returned a 404 then it would hit B.
> Is this something that I should implement as a web server or as a
> proxy server? Is there actually a difference?

Well, de facto it will (almost-*) always be a proxy, proxy is
something that forwards requests and responses. One thing to note is
that if you want backend servers to see the client IP, some extra
effort is needed (like mod_rpaf on backend and adding X-Forwarded-For
on proxy).

nginx suggestion is good one, although of course not the only
possible.  I believe almost every product suitable to work as
reverse-proxy should handle this use case.

*) There exists the solution which does not require a proxy (and is
reasonable if most of the requests go to the first server). Just
have clients accessing the first server but in error handler redirect
them to the second server whenever they face 404.  This way one item
less to manage. But such process will not be transparent for users,
they will see different URLs.

More information about the Twisted-Python mailing list