mirror of
https://github.com/fosrl/newt.git
synced 2026-05-06 07:59:04 -05:00
[GH-ISSUE #240] Newt health check expects 2xx response code after server restart #1748
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @xupefei on GitHub (Feb 18, 2026).
Original GitHub issue: https://github.com/fosrl/newt/issues/240
Originally assigned to: @LaurenceJJones on GitHub.
Describe the Bug
When a Pangolin server got restarted and Newt reconnected, existing health checks with custom Response Codes are reverted to 2xx.
Environment
To Reproduce
Target 1 initial status: healthy.health check failed with status code 409. Note that we are actually expecting 409 to be a good response.Looking at the code, it seems Newt is now expecting 200-300 codes instead, because if otherwise the log will be the following:
instead of (when checking for 2xx range)
The logic of printing different logs is at
b7af49d759/healthcheck/healthcheck.go (L428-L449)This suggests that Newt is expecting the response code to be the default 2xx instead of the custom one.
Attached screenshots:
My health check settings with a custom response code:

Newt log after server restart:

Expected Behavior
The service should work. However now with a failed health check, the service is always down.
@DevNinja90 commented on GitHub (Mar 5, 2026):
We can confirm the bug. The issue is witin newt restarts.
Our hcStatusCode is expected to be 401 (Unauthorized). Newt resets this to 200 after a restart. Only reconfiguring it in pangolin pushes the correct hcStatus to newt.
For debugging purposes the hcStatusCode is not shown in newt debug logs on receiving the registration message data. This made me think. Maybe the Code is not send to newt in the first place? It turns out that is correct.
⭕ Pangolin bug.
❓ no hcStatus
the function buildTargetConfigurationForNewtClient is missing the hcStatus.
in here https://github.com/fosrl/pangolin/blob/1.16.2/server/routers/newt/buildConfiguration.ts#L168
When changing a config in pangolin the function addTargets sends the hcStatus
https://github.com/fosrl/pangolin/blob/1.16.2/server/routers/newt/targets.ts
I think a simple fix 👯
@LaurenceJJones commented on GitHub (Mar 7, 2026):
Thanks for the debugging @DevNinja90 your correct, the initial healthcheck that is sent when a resource is created includes the custom status, when newt reconnects and get sent the connect websocket this was missing the custom status. Opened a PR to get this resolved.
@LaurenceJJones commented on GitHub (Mar 10, 2026):
will be resolved in next pangolin release, closing as completed as development fix has been issued.