2016-12-01 6 views
2

반환HAProxy 상태 검사가 작동하지 않습니다하지만 CURL 나는 다음과 같은 백엔드로 구성된 HAProxy 건강 검진이 200 OK

backend php_servers 
    http-request set-header X-Forwarded-Port %[dst_port] 
    option httpchk get /health 
    http-check expect status 200 
    server php1 internal_ip:80 check 

HAProxy 서버를 사용하지 않고 CURL을 사용할 때는 200 OK 응답을받을 수 있습니다.

Command: curl -I internal_ip/health 
Response: 
HTTP/1.1 200 OK 
Server: nginx 
Date: Thu, 01 Dec 2016 20:53:48 GMT 
Content-Type: text/html; charset=UTF-8 
Connection: keep-alive 
Access-Control-Allow-Origin: api.flex-appeal.nl 
X-Frame-Options: SAMEORIGIN 
X-Content-Type-Options: nosniff 
X-XSS-Protection: 1; mode=block 
Cache-Control: no-transform 

왜 HAProxy는 서버를 "UP"으로 인식하지 않습니까? 내가 잘 연결할 수있는 것 같아.

답변

2

올바른 HTTP 동사 GET하지 get입니다 :

option httpchk GET /health 

당신은 또한 stats page을 활성화/확인할 수 있습니다이 검사가 실패하는 이유 LastChk 열이 을 볼 수 있습니다. 필자의 경우 응답은 501 Not Implemented입니다.

내가 HAProxy 같은 요청을 수행하여 재현 할 수

$ telnet localhost 80 
Trying ::1... 
Connected to localhost. 
Escape character is '^]'. 
get /health HTTP/1.0 

HTTP/1.1 501 Not Implemented 
Date: Thu, 01 Dec 2016 21:53:09 GMT 
Server: Apache/2.4.23 (Unix) PHP/7.0.13 
[...]