考虑此最小的HAProxy 2.0配置
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
我本以为HAProxy会在端口8000上侦听HTTP代理请求(但限制是不能根据documentation解析IP地址。
不幸的是,我只会得到500的错误:
$ 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>
我是否误解了http_proxy
选项,还是我的配置中还有其他问题?
答案 0 :(得分:1)
这看起来像是刚刚修复的错误BUG/MEDIUM: http/htx: unbreak option http_proxy。您可以尝试使用此修复程序构建版本,或者等待下一个版本。