Hi Veit, On Thu, Jun 02, 2011 at 05:10:43PM +0200, Veit Guna wrote: > Hi. > > I'm trying to use haproxy as a http proxy for certain urls. My plan is > to specify always the haproxy in the client and to decide in haproxy > if an "upstream" proxy should be used or if the connection should be > made "direct" without an additional proxy configured within haproxy. > > I took a look at the documentation, but I couldn't find an option to say > that the connection should simply made directly by haproxy as > "passthrough" and not via backend/server delegation. Is that even > possible with haproxy? To make direct connections to the origin address > which came in via http request? > > If I leave the backend definition empty (without specifying a "server"), > haproxy returns a 503, complaining about <NOSRV> in the log. > So how can I tell haproxy to create the connection to original url by > itself instead of delegating it to an upstream proxy?
haproxy is not an HTTP proxy but a reverse proxy (or a "gateway" using the HTTP terminology). It will not resolve the host name on a request to connect to the server by itself. However, there is a rarely used feature which makes it able to do this only in the situation where pure IP addresses are passed in the URL (check for "option http_proxy" in the doc). But I'm sure it will not be suitable for your needs. If you have set it as a transparent proxy, you still have the original destination address and can forward to the address that was resolved by the client (switch to a backend section running in transparent mode). But I don't know if that's your case either. Regards, Willy

