Fix: support Apache Listen ip:port format in healthcheck#212
Fix: support Apache Listen ip:port format in healthcheck#212Lyric-c wants to merge 1 commit intolinuxserver:masterfrom
Conversation
There was a problem hiding this comment.
Thanks for opening this pull request! Be sure to follow the pull request template!
|
I am a bot, here are the test results for this PR:
|
|
I am a bot, here are the test results for this PR:
|
Description:
The current implementation assumes that the Apache Listen directive
contains only a port number (e.g. "Listen 80").
However, Apache also supports the "ip:port" format, such as:
Listen 127.0.0.1:3000
In this case, the existing parsing logic extracts "127.0.0.1:3000"
and passes it directly to netcat as the port argument, which results in:
This PR updates the parsing logic to extract only the port portion
from the Listen directive, ensuring compatibility with both formats.
It also ensures only the first Listen directive is used to avoid
passing multiple ports to netcat.
Benefits of this PR and context:
This change improves robustness without altering existing behavior
for standard configurations.
This issue may occur when users run the container with host networking
and bind Apache explicitly to localhost (127.0.0.1).
How Has This Been Tested?
Tested in a Docker environment using linuxserver/smokeping:2.9.0.
Test cases:
Default configuration:
Listen 80
→ Healthcheck works as expected
Custom port:
Listen 3000
→ Healthcheck works as expected
IP + port configuration:
Listen 127.0.0.1:3000
→ Previously failed with:
nc: port number invalid
→ After patch:
Healthcheck succeeds correctly
Multiple Listen directives:
Listen 127.0.0.1:3000
Listen 0.0.0.0:8080
→ Healthcheck uses the first Listen directive (3000)
→ Container starts and healthcheck succeeds
Also verified that the container starts normally and Apache becomes available
without impacting other functionality.
Source / References:
Apache Listen directive documentation:
https://httpd.apache.org/docs/current/mod/mpm_common.html#listen
Netcat usage reference:
nc -z
This issue was identified by inspecting the generated s6 service run script:
/var/run/s6/db/servicedirs/svc-apache/run