
포트 80을 수신하기 위해 haproxy를 사용해야 하고 해당 역할과 일치하는 경우 요청을 전달해야 합니다. 이 작업을 수행했지만 프로버 백엔드를 사용하도록 어떻게 알 수 있는지 모르겠습니다.
frontend httpfw
bind *:80
mode http
acl # what I must write here to defend a domain like test1.com
acl # what I must write here to defend a domain like test2.com
use_backend httptest1 if # how can I told to use this backend if the request comes from test1.com
use_backend httptest2 if # how can I told to use this backend if the request come from test2.com
backend httptest1
mode http
balance source
server httptest1 1.1.1.1:80
backend httptest2
mode http
balance source
server httptest2 2.2.2.2:80
감사해요 :)
답변1
다음은 제공한 예시에서 트래픽을 각 백엔드로 라우팅해야 합니다.
## Look at host header
acl host_test1 hdr(host) -i test1.com
acl host_test2 hdr(host) -i test2.com
## figure out which one to use depending on the criteria above
use_backend httptest1 if host_test1
use_backend httptest2 if host_test2