# HAProxy httpcheck strange behavior

**URL:** https://discourse.haproxy.org/t/haproxy-httpcheck-strange-behavior/8213
**Category:** Help!
**Created:** [December 12, 2022, 2:59pm UTC](https://discourse.haproxy.org/t/haproxy-httpcheck-strange-behavior/8213 "2022-12-12T14:59:56Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![santoriox](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@santoriox](https://discourse.haproxy.org/u/santoriox)
#### Post date: [December 12, 2022, 2:59pm UTC](https://discourse.haproxy.org/t/haproxy-httpcheck-strange-behavior/8213/1 "2022-12-12T14:59:56Z")

</div>

There is HAProxy server (version 1.8). Recently I configured http healthcheck to MS Exchange 2016 (configuration was taken from [https://bidhankhatri.com.np/system/haproxy-configuration-for-windows-exchange-server-2016-and-2019/](https://bidhankhatri.com.np/system/haproxy-configuration-for-windows-exchange-server-2016-and-2019/)).

Now I try to update version of HAProxy to LTS on Debian 11 (from stable repository version is 2.2.9).

After all updates in confiration file, I have successful validation check. But now I constantly get log warning:

```auto
Dec 12 16:16:00 lb-03 haproxy[100159]: [WARNING] (100159) : Health check for server B-EXCHANGE-MAPI/mail-03-mapi failed, reason: Layer4 timeout, check duration: 2001ms, status: 2/3 UP.
Dec 12 16:16:02 lb-03 haproxy[100159]: [WARNING] (100159) : Health check for server B-EXCHANGE-MAPI/mail-03-mapi succeeded, reason: Layer7 check passed, code: 200, check duration: 2ms, status: 3/3 UP.
Dec 12 16:16:05 lb-03 haproxy[100159]: [WARNING] (100159) : Health check for server B-EXCHANGE-EWS/mail-03-ews failed, reason: Layer4 timeout, check duration: 2000ms, status: 2/3 UP.
Dec 12 16:16:07 lb-03 haproxy[100159]: [WARNING] (100159) : Health check for server B-EXCHANGE-EWS/mail-03-ews succeeded, reason: Layer7 check passed, code: 200, check duration: 1ms, status: 3/3 UP.
Dec 12 16:18:42 lb-03 haproxy[100159]: [WARNING] (100159) : Health check for server B-EXCHANGE-ECP/mail-05-ecp failed, reason: Layer4 timeout, check duration: 2001ms, status: 2/3 UP.
Dec 12 16:18:44 lb-03 haproxy[100159]: [WARNING] (100159) : Health check for server B-EXCHANGE-ECP/mail-05-ecp succeeded, reason: Layer7 check passed, code: 200, check duration: 2ms, status: 3/3 UP.

```

I try to increse check interval – get fewer messages but they are not dissapire.  
Installed version 2.4 from backports – nothing changes.  
Dump of traffic doesn’t show any errors.

Backends with http check but are had two servers in backend don’t get this errors.

All these backens point on same two MS Exchange servers and each of them has http check:

```auto
use_backend B-EXCHANGE-OWA if A-EXCHANGE-HOSTNAME owa
use_backend B-EXCHANGE-AUTODISCOVER if A-EXCHANGE-HOSTNAME autodiscover
use_backend B-EXCHANGE-MAPI if A-EXCHANGE-HOSTNAME mapi
use_backend B-EXCHANGE-ACTIVESYNC if A-EXCHANGE-HOSTNAME eas
use_backend B-EXCHANGE-EWS if A-EXCHANGE-HOSTNAME ews
use_backend B-EXCHANGE-ECP if A-EXCHANGE-HOSTNAME ecp
use_backend B-EXCHANGE-RPC if A-EXCHANGE-HOSTNAME rpc
use_backend B-EXCHANGE-OAB if A-EXCHANGE-HOSTNAME oab

```

I have no idea what else can be done.

---

<div class="post-metadata">

### Author: ![stormrover](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/stormrover/32/1847_2.png) [@stormrover](https://discourse.haproxy.org/u/stormrover)
#### Post date: [December 13, 2022, 12:06pm UTC](https://discourse.haproxy.org/t/haproxy-httpcheck-strange-behavior/8213/2 "2022-12-13T12:06:55Z")

</div>

At a glance, I would try increasing the timeout allowed by healthchecks and see if that alleviates this error. Something like this:

```auto
backend be_ex2019_activesync
	mode http
	timeout check 5s

```

Source: [HAProxy 2.2 Configuration Manual - timeout check](http://docs.haproxy.org/2.2/configuration.html#4.2-timeout%20check)

---

<div class="post-metadata">

### Author: ![santoriox](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@santoriox](https://discourse.haproxy.org/u/santoriox)
#### Post date: [December 13, 2022, 3:32pm UTC](https://discourse.haproxy.org/t/haproxy-httpcheck-strange-behavior/8213/3 "2022-12-13T15:32:30Z")

</div>

![изображение](https://us1.discourse-cdn.com/flex016/uploads/haproxy/original/2X/7/70aece23c88bb6e5f972d91a2ba31ebfc3aafd05.png)  
I have a default “timeout check 10s”

When I add source IP and port range to “server” option warning logs is dissapeared:

 ![изображение](https://us1.discourse-cdn.com/flex016/uploads/haproxy/original/2X/7/77b1dbf5c0e0d5410033a2a808bae8808704a037.png)

And I can’t explain why.

---

<div class="post-metadata">

### Author: ![santoriox](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@santoriox](https://discourse.haproxy.org/u/santoriox)
#### Post date: [December 15, 2022, 9:21am UTC](https://discourse.haproxy.org/t/haproxy-httpcheck-strange-behavior/8213/4 "2022-12-15T09:21:51Z")

</div>

Now I have [the same problem](https://learn.microsoft.com/en-us/answers/questions/907730/exchange-2019-load-balacning-with-negotate-iis.html)

---

<div class="post-metadata">

### Author: ![findmyname](https://avatars.discourse-cdn.com/v4/letter/f/f0a364/32.png) [@findmyname](https://discourse.haproxy.org/u/findmyname)
#### Post date: [December 16, 2022, 8:50am UTC](https://discourse.haproxy.org/t/haproxy-httpcheck-strange-behavior/8213/5 "2022-12-16T08:50:48Z")

</div>

> [@santoriox](#):
>
> ```auto
> Dec 12 16:18:42 lb-03 haproxy[100159]: [WARNING] (100159) : Health check for server B-EXCHANGE-ECP/mail-05-ecp failed, reason: Layer4 timeout, check duration: 2001ms, status: 2/3 UP.
> 
> ```

By default the health check timeout is configured by [inter](http://docs.haproxy.org/2.6/configuration.html#5.2-inter) option on the server line. That is the reason why you see 2 sec timeouts. There is also option [timeout check](http://docs.haproxy.org/2.6/configuration.html#timeout%20check) - pls read it there is explained behaviour because it isn’t used for connection timeout. I would recommend to increase `inter` for testing purposes.

---

<div class="post-metadata">

### Author: ![santoriox](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@santoriox](https://discourse.haproxy.org/u/santoriox)
#### Post date: [December 16, 2022, 9:20am UTC](https://discourse.haproxy.org/t/haproxy-httpcheck-strange-behavior/8213/6 "2022-12-16T09:20:50Z")

</div>

I thought that “inter” is the time between requests. I tried to increase the interval to 15 seconds - the errors began to appear much less often, once every few hours, not ten times per hour.

---

<div class="post-metadata">

### Author: ![findmyname](https://avatars.discourse-cdn.com/v4/letter/f/f0a364/32.png) [@findmyname](https://discourse.haproxy.org/u/findmyname)
#### Post date: [December 16, 2022, 9:44am UTC](https://discourse.haproxy.org/t/haproxy-httpcheck-strange-behavior/8213/7 "2022-12-16T09:44:01Z")

</div>

> I thought that “inter” is the time between requests.

It is but it is also used for connection timeout in some cases:

```auto
If set, HAProxy uses min("timeout connect", "inter") as a connect timeout
for check and "timeout check" as an additional read timeout.

```

However it sounds pretty weird that your connection timeout even with 15 sec.  
Is the server overloaded or so ? it doesn’t look healthy …

---

<div class="post-metadata">

### Author: ![santoriox](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@santoriox](https://discourse.haproxy.org/u/santoriox)
#### Post date: [December 16, 2022, 9:54am UTC](https://discourse.haproxy.org/t/haproxy-httpcheck-strange-behavior/8213/8 "2022-12-16T09:54:05Z")

</div>

> Is the server overloaded or so?

It isn’t. I have a production HAProxy (ver. 1.8) and it has default configuration of timeouts and the same configuration of health check and no errors at all.

---

<div class="post-metadata">

### Author: ![findmyname](https://avatars.discourse-cdn.com/v4/letter/f/f0a364/32.png) [@findmyname](https://discourse.haproxy.org/u/findmyname)
#### Post date: [December 17, 2022, 6:26pm UTC](https://discourse.haproxy.org/t/haproxy-httpcheck-strange-behavior/8213/9 "2022-12-17T18:26:38Z")

</div>

> When I add source IP and port range to “server” option warning logs is dissapeared:

I missed this comment. Is it still the case that `source` fix your issue ?  
It is possible that there is something wrong with network, firewall or ipv4/6 ?

---

<div class="post-metadata">

### Author: ![santoriox](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@santoriox](https://discourse.haproxy.org/u/santoriox)
#### Post date: [December 19, 2022, 7:22am UTC](https://discourse.haproxy.org/t/haproxy-httpcheck-strange-behavior/8213/10 "2022-12-19T07:22:57Z")

</div>

> Is it still the case that `source` fix your issue?  
> Yes, it is. I have a source IP in global configuration because I use keepalived and the same source IP address in backend section fix issue with partioal Layer4 healthcheck.

> It is possible that there is something wrong with network, firewall or ipv4/6?  
> I don’t disable ipv6 but I don’t use IPv6 at all. Firewall and network is checked first and I don’t find out any issue.
