Heartbeat response code showing 200 but it is actually 502

Hello everyone!
So I have a bunch of website monitors and one of them right not working and showing 502 Bad gateway (Chrome inspect also showing status 502). But my heartbeat (v. 7.14.0) showing response status 200. Any ideas why it is showing like that? Heartbeat using Debian machine.

Can you share your config, the Heartbeat response and a curl/etc response (with the 502).

Curl

curl -I balk.tm
HTTP/1.1 502 Bad Gateway
Server: nginx/1.18.0
Date: Mon, 20 Sep 2021 05:52:25 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 157
Connection: keep-alive

Conf

- type: http
  id: 167
  name: Balk
  enabled: true
  schedule: "@every 60s"
  urls: ["https://balk.tm"]
  ssl.verification_mode: none

Heartbeat response. I changed website name for security

Response headers
Cache-Control
max-age=600
Content-Type
text/html; charset=UTF-8
Date
Mon, 20 Sep 2021 06:16:18 GMT
Expires
Sat, 11 Sep 2021 11:09:57 GMT
Link
<https://balk.tm/wp-json/>; rel="https://api.w.org/", <https://balk.tm/wp-json/wp/v2/pages/883>; rel="alternate"; type="application/json", <https://balk.tm/>; rel=shortlink
Server
nginx/1.18.0
Strict-Transport-Security
max-age=604800
Vary
Accept-Encoding
X-Powered-By
PHP/7.1.29

This is really hard to debug without having access to the site itself or a reproducible test case on our end. It's unlikely that this is a bug in heartbeat's status code handling, and most likely that your site actually is responding with 200.

If your application is handling heartbeat differently (maybe based on user-agent or other headers?) and it is indeed responding 200 to heartbeat, you'll have to look into the application code to understand why.

If you can create a publicly reproducible test case that would be helpful.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.