Re: forward proxy ?

From: Willy Tarreau <w#1wt.eu>
Date: Wed, 21 Apr 2010 21:52:36 +0200


On Wed, Apr 21, 2010 at 01:08:31PM +0200, Jan-Frode Myklebust wrote:
> We have a bunch of settop-boxes that needs to access some broken
> http-servers (shoutcast) that doesn't support HTTP HEAD requests,
> and my clients get upset if we use a proxy-server that fails with 502's
> on these requests... (f.ex. squid and mod_proxy will do that).
>
> So we're wondering if haproxy might help us as a more pure tcp-proxy
> servere. What we need is to f.ex. be able to send a an URL like:
>
> http://haproxy-server.example.com/proxy/http://scfire-ntc-aa01.stream.aol.com/stream/1075
>
> and have the complete request proxied to:
>
> http://scfire-ntc-aa01.stream.aol.com/stream/1075
>
> Is that something HAproxy can do ?

No it can't perform host name resolution. However, it supports an http_proxy mode which makes it able to parse proxy requests and connect to the server if the host part is only composed of numeric IP addresses. Maybe that will not suit your needs, I don't know. Otherwise, one possibility would be to set it up in front of your squid server so that haproxy rewrites the URL for squid to use it.

(...)
> # Want this:
> $ curl --head http://scfire-ntc-aa01.stream.aol.com/stream/1075
> curl: (52) Empty reply from server
>
> # Squid will give us:
> $ export ALL_PROXY=localhost:3128
> $ curl --head http://scfire-ntc-aa01.stream.aol.com/stream/1075
> HTTP/1.0 502 Bad Gateway
> Server: squid

(...)

You can also use haproxy in front of squid to suppress the 502 in the response, because you can make it block this response (which normally also causes a 502 to be sent to the client), but you can define what to send on the 502 error. Basically it would look like this :

        rspdeny ^HTTP/1.0\ 502
        errorfile 502 /dev/null

BTW, I'm recalling that squid also supports custom error responses, but I don't know if you can rewrite the status code or not.

Regards,
Willy Received on 2010/04/21 21:52

This archive was generated by hypermail 2.2.0 : 2010/04/21 22:00 CEST