Search code examples
haproxy

HAProxy only returns error 500 in forward proxy mode


Consider this minimal HAProxy 2.0 configuration

defaults
    timeout connect 5s
    timeout client 5s
    timeout server 5s
    option http_proxy
    mode http

frontend proxy_in
    bind :8000
    default_backend proxy_out

backend proxy_out
    option http_proxy

I would have expected that HAProxy would listen on port 8000 for HTTP Proxy requests (with the limitation of not resolving IP addresses according to the documentation.

Unfortunately, I do only get errors 500 back:

$ curl -v -x localhost:8000 http://1.1.1.1
* Rebuilt URL to: http://1.1.1.1/
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8000 (#0)
> GET http://1.1.1.1/ HTTP/1.1
> Host: 1.1.1.1
> User-Agent: curl/7.54.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 500 Internal Server Error
< content-length: 96
< cache-control: no-cache
< content-type: text/html
< connection: close
<
<html><body><h1>500 Internal Server Error</h1>
An internal server error occured.
</body></html>

Am I misunderstanding the http_proxy option or is there another issue in my configuration?


Solution

  • This looks like to the bug which was just fixed BUG/MEDIUM: http/htx: unbreak option http_proxy. You can try to build a version with this fix or wait to the next version.