Skip to content

Read the health check path from the configuration file - #46

Merged
satishweb merged 3 commits into
masterfrom
fix/healthcheck-path
Oct 21, 2026
Merged

satishweb merged 3 commits into
masterfrom
fix/healthcheck-path

Conversation

@satishweb

Copy link
Copy Markdown
Owner

The health check requested the path from the DOH_HTTP_PREFIX variable, so it probed a path that does not exist when that variable was empty or contained whitespace. The container was then reported as unhealthy even though the server was running and answering queries.

The health check is a small script now. It reads the path from the configuration file that is in use, which is the source of truth and works for a generated configuration as well as for a mounted one. When the configuration can not be read, any answer from the server is accepted.

The script is installed with mode 0755, it is executed as the unprivileged user of the container and was not executable for it before.

The test suite now checks a matrix of path configurations, every entry starts a container and asserts that it becomes healthy, that the configured paths answer and that an unknown path is not served. The matrix covers the paths of the helm chart and the example of the readme as well.

The upstream server registers every path of the comma separated path option
on its HTTP mux. Registering the same path twice makes the Go HTTP mux
panic, so the server stopped right after it was started:

    panic: pattern "/dns-query" (registered at server.go:106) conflicts
    with pattern "/dns-query" (registered at server.go:106)

This happened for every configuration where the primary path is the same
as one of the additional paths. With the default of DOH_HTTP_PREFIXES it
happened for every user that sets DOH_HTTP_PREFIX to /dns-query.

The entrypoint now skips a path that is already configured and the patch
for the upstream server skips a path that is already registered as well, so
a hand written configuration with a duplicated path does not panic either.

The test suite starts a container with the same path as the primary and the
additional path and asserts that it starts and answers queries.

Fixes #40
The health check requested the path from the DOH_HTTP_PREFIX variable, so
it probed a path that does not exist when that variable was empty or
contained whitespace. The container was then reported as unhealthy even
though the server was running and answering queries.

The health check is a small script now. It reads the path from the
configuration file that is in use, which is the source of truth and works
for a generated configuration as well as for a mounted one. When the
configuration can not be read, any answer from the server is accepted.

The script is installed with mode 0755, it is executed as the
unprivileged user of the container and was not executable for it before.

The test suite now checks a matrix of path configurations, every entry
starts a container and asserts that it becomes healthy, that the
configured paths answer and that an unknown path is not served. The
matrix covers the paths of the helm chart and the example of the readme as
well.
@satishweb
satishweb merged commit 1869069 into master Oct 21, 2026
4 checks passed
@satishweb
satishweb deleted the fix/healthcheck-path branch October 21, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant