filebrowser: fix healthcheck protocol detection with ssl enabled

The HEALTHCHECK branched on "$ssl", but that variable is never present
in the container environment: Supervisor only injects the environment:
block from config.yaml (FB_BASEURL, PGID, PUID) plus TZ/SUPERVISOR_TOKEN.
The ssl option lives in /data/options.json and is read via bashio inside
cont-init, and HEALTHCHECK CMD is spawned by dockerd, so no export from
that shell can ever reach it.

The test was therefore always false and the healthcheck kept probing
http:// against the TLS listener, producing the

  http: TLS handshake error ... client sent an HTTP request to an HTTPS server

spam reported in #2881.

Write the resolved protocol to /run/health_protocol from 99-run.sh and
read it back in the healthcheck, matching the pattern already used by
the gitea addon. Also corrects the 127.0.01 typo (missing octet).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
alexbelgium
2026-07-26 07:57:09 +02:00
parent b081e94323
commit 278818970f
4 changed files with 8 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
## 2.63.18.5 (26-07-2026)
- Fixed healthcheck log spam when ssl is enabled (#2881)
## 2.63.18.4 (22-07-2026)
- Minor bugs fixed
## 2.63.18.3 (22-07-2026)

View File

@@ -134,4 +134,4 @@ HEALTHCHECK \
--retries=5 \
--start-period=30s \
--timeout=25s \
CMD if [ "$ssl" = "true" ]; then curl -A "HealthCheck: Docker/1.0" -s -f -k https://127.0.01:${HEALTH_PORT}${HEALTH_URL}; else curl -A "HealthCheck: Docker/1.0" -s -f http://127.0.0.1:${HEALTH_PORT}${HEALTH_URL}/; fi
CMD curl -A "HealthCheck: Docker/1.0" -s -f -k "$(cat /run/health_protocol 2>/dev/null || echo http)://127.0.0.1:${HEALTH_PORT}${HEALTH_URL}/" >/dev/null 2>&1 || exit 1

View File

@@ -126,4 +126,4 @@ schema:
slug: filebrowser
udev: true
url: https://github.com/alexbelgium/hassio-addons
version: "2.63.18.4"
version: "2.63.18.5"

View File

@@ -51,6 +51,10 @@ if bashio::config.true 'ssl'; then
ADDON_PROTOCOL=https
fi
# Expose the protocol to the docker HEALTHCHECK, which runs outside this
# shell and therefore cannot read the addon options
echo -n "${ADDON_PROTOCOL}" > /run/health_protocol
#port=$(bashio::addon.port 80)
ingress_port=$(bashio::addon.ingress_port)
ingress_interface=$(bashio::addon.ip_address)