RCross
RCross

Reputation: 5118

HA Proxy using tcp-check for HTTP connections

I'm trying to load balance an Atlassian Bitbucket cluster with HA Proxy so that SSH endpoints are marked down if the corresponding http status check on the same server fails.

The configuration below used to work fine but, since upgrading to Bitbucket 6.10.5 (which has a new embedded Tomcat server), I'm now getting the error "Server bitbucket_ssh/bitbucket1 is DOWN, reason: Layer7 invalid response, info: "TCPCHK got an empty response at step 7 comment: 'HTTP Status'".

If I curl http://bitbucket1.mydomain:8200/status, the response comes back {"state":"RUNNING"}, same as before the upgrade.

What could be causing the empty response?

backend bitbucket_ssh
  mode tcp
  balance roundrobin
  option tcp-check
  tcp-check comment "SSH Check"
  tcp-check connect port 8203
  tcp-check expect rstring ^SSH.*$
  tcp-check comment "HTTP Status"
  tcp-check connect port 8200
  tcp-check send GET\ /status\r\n
  tcp-check expect string RUNNING
  server bitbucket1 bitbucket1.mydomain:8203 check
  server bitbucket2 bitbucket2.mydomain:8203 check
  server bitbucket3 bitbucket3.mydomain:8203 check

Upvotes: 2

Views: 1921

Answers (1)

RCross
RCross

Reputation: 5118

It seems the newer Tomcat server needs an explicit HTTP/1.0 connection with an extra CR-LF.

Changing:

tcp-check send GET\ /status\r\n

to

tcp-check send GET\ /status\ HTTP/1.0\r\n
tcp-check send \r\n

got it running.

Upvotes: 2

Related Questions