问题描述
我的HAProxy配置中有一个HAProxy HTTP前端,如下所示:
I have an HAProxy HTTP Frontend in my HAProxy config like so:
frontend myaddress.net :10098
bind :80,:8080
mode http
log global
option http-server-close
timeout client 14400000
timeout connect 60000
timeout tunnel 14400000
timeout http-request 14400000
capture request header User-Agent len 64
capture request header Accept-language len 64
capture request header x-forward len 15
capture request header host len 64
capture request header X-Orig-Base len 64
capture request header X-Orig-Host len 64
capture request header X-Orig-Proto len 64
reqadd X-Original-host:\ myaddress.net
acl is-ssl hdr(X-Orig-Proto) https
acl is-http hdr(X-Orig-Proto) http
redirect code 301 prefix https://myaddress.net if is-http
default_backend BACKEND_myaddress.net:catchall
它指向这样定义的后端:
It points to a backend defined like so:
backend BACKEND_myaddress.net:catchall
timeout server 4h
balance leastconn
server myserver myserver:8080 check inter 5s rise 3 fall 1
我已经开始侦听端口80,然后转发到后端服务器上的8080,但是现在我试图使其也在前端的8080端口上侦听(不要问我为什么,这是la脚的要求).
I've got it working to listen on port 80, then forward to 8080 on the backend server, but now I'm trying to make it also listen on port 8080 on the frontend (don't ask me why, it's a lame requirement).
如您所见,我有一行显示bind :80,:8080
.我以为这会使前端也监听8080端口,但似乎没有监听8080端口.
As you can see, I've got a line that says bind :80,:8080
. I thought that would make the frontend also listen on port 8080, but it's not appearing to listen on port 8080.
此配置中是否缺少某些内容?如何使前端在端口8080和80上侦听,然后转发到端口8080上的后端服务器?
Is there something I'm missing in this configuration? How can I make a frontend listen on port 8080 and 80, which then forwards to the backend server on port 8080?
推荐答案
在前端部分尝试以下操作:
Try this in your frontend section:
bind :80
bind :8080
这篇关于HAProxy-配置HTTP前端以侦听多个端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!