502服务器中的网关Haproxy错误
我们在端口8080上运行一台服务器,每当向服务器发送请求时,它都会返回响应 在同一个实例上,Haproxy在443上运行(使用SSL),当我向Haproxy(IP:443)发布相同的请求时,它抛出了“502坏网关”错误 我能知道有什么问题吗 以下是Haproxy配置:502服务器中的网关Haproxy错误,proxy,haproxy,Proxy,Haproxy,我们在端口8080上运行一台服务器,每当向服务器发送请求时,它都会返回响应 在同一个实例上,Haproxy在443上运行(使用SSL),当我向Haproxy(IP:443)发布相同的请求时,它抛出了“502坏网关”错误 我能知道有什么问题吗 以下是Haproxy配置: global maxconn 2048 tune.ssl.default-dh-param 2048 daemon defaults mode htt
global
maxconn 2048
tune.ssl.default-dh-param 2048
daemon
defaults
mode http
option forwardfor
option http-server-close
retries 3
timeout http-request 5000s
timeout queue 3m
timeout connect 5000s
timeout client 3m
timeout server 3m
timeout http-keep-alive 5000s
timeout check 4000s
maxconn 2048
frontend www-https
bind *:443 ssl crt /etc/ssl/haproxy/app-ssl.pem
reqadd X-Forwarded-Proto:\ https
default_backend www-backend
backend www-backend
redirect scheme https if !{ ssl_fc }
server www-1 localhost:8080 check
listen stats
bind *:28080
mode http
stats enable
stats uri /haproxy?stats
增加全球价值
tune.maxrewrite 4096
然后它就工作了
Haproxy配置应如下所示:
global
maxconn 2048
tune.ssl.default-dh-param 2048
tune.maxrewrite 4096
daemon
defaults
mode http
option forwardfor
option http-server-close
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 2048
frontend www-https
bind *:443 ssl crt /etc/ssl/haproxy/ede-ssl.pem
reqadd X-Forwarded-Proto:\ https
default_backend www-backend
backend www-backend
redirect scheme https if !{ ssl_fc }
server www-1 localhost:8080 check
listen stats
bind *:28080
mode http
stats enable
stats uri /haproxy?stats
请查看以下说明:
tune.bufsize
将缓冲区大小设置为此大小(以字节为单位)。较低的值允许更多的值
会话共存于相同数量的RAM中,并且更高的值允许
具有非常大cookie的应用程序可以正常工作。默认值为16384和
可以在构建时更改。强烈建议不要更改此设置
从默认值开始,因为非常低的值会破坏某些服务,例如
统计信息和大于默认大小的值将增加内存使用,
可能导致系统内存不足。至少是全球maxconn
参数的减少应与此参数的增加相同。
如果HTTP请求大于(tune.bufsize-tune.maxrewite),haproxy将
返回HTTP 400(错误请求)错误。类似地,如果HTTP响应更大
如果超过此大小,haproxy将返回HTTP 502(坏网关)在haproxy错误日志中找到相应条目并将其编辑到问题中。日志中有一段代码可以解释确切的问题。