Welcome! Log In Create A New Profile

Advanced

[PATCH] BUG/MINOR: http: Return an error in proxy mode when url2sa fails

Posted by Christopher Faulet 
Hi,

Here is a patch fixing an old bug in proxy mode, when you mix valid
requests (using an IP) with invalid ones (with a domain name for instance).

With following configuration:

listen test
mode http
bind *:8888
option http_proxy

try to do:

$> printf "GET http://pouet.com/ HTTP/1.0\r\n\r\n" | nc 127.0.0.1 8888

You will have a 503 returned by HAProxy, because there is no DNS
resolution, as stated in the documentation. Then try:

$> printf "GET http://51.15.8.218 HTTP/1.0\r\nHost:
www.haproxy.org\r\n\r\n" | nc 127.0.0.1 8888

You will get a haproxy.org homepage. Then retry the first request. It
should return the same error...

$> printf "GET http://pouet.com/ HTTP/1.0\r\n\r\n" | nc 127.0.0.1 8888

.... But, instead you will have a 404 from haproxy.org (because there is
no Host header).

With the patches, HAProxy always return an error 400 in this case.

--
Christopher Faulet
On Mon, Apr 16, 2018 at 10:29:11AM +0200, Christopher Faulet wrote:
> Here is a patch fixing an old bug in proxy mode, when you mix valid requests
> (using an IP) with invalid ones (with a domain name for instance).
>
> With following configuration:
>
> listen test
> mode http
> bind *:8888
> option http_proxy
(...)

Now applied, thank you Christopher.

Willy
Sorry, only registered users may post in this forum.

Click here to login