Skip to content

fix: publish nginx on the configured ports - #1546

Open
geodro wants to merge 1 commit into
mainfrom
fix/1544-nginx-configured-ports
Open

fix: publish nginx on the configured ports#1546
geodro wants to merge 1 commit into
mainfrom
fix/1544-nginx-configured-ports

Conversation

@geodro

@geodro geodro commented Aug 23, 2026

Copy link
Copy Markdown
Member

nginx.http_port and nginx.https_port were honoured by everything that talks to nginx, the share commands, the profiler probe, the watcher, the install-time port check, but never by the thing that actually binds. Both writers rendered the bundled quadlet template, which publishes 80:80 and 443:443, and nothing substituted the configured values. On a host where another service owns those ports there was no supported way to move nginx off them.

Worth flagging for the report: this is not macOS-only. The launchd generator builds its -p arguments from the quadlet's PublishPort lines, so the plist was faithfully reproducing a template both platforms share, and a Linux install should have been just as broken.

ApplyNginxPorts rewrites the host side of those mappings by matching the container port, so 80 and 443 stay inside the container where nginx listens and only the host side moves. It runs before the loopback and IPv6 prefixes are added, so it handles either form, and a port left unset keeps the bundled default. Both writers call it, since having two of them is how this was missed, and config.NginxPorts is now the single place the two numbers come from.

Doctor's port section was the visible half of the same problem. It probed the literal 80 and 443, and when nginx was up it reported them fine without probing anything, so a host with nginx demonstrably on 10080 was told about port 80 either way. It now reports and probes whatever is configured.

Refs #1544

nginx.http_port and nginx.https_port were read by everything that talks to nginx, the share commands, the profiler probe, the watcher and the install-time port check, but never by the thing that actually binds. Both writers rendered the bundled quadlet template, which publishes 80:80 and 443:443, and nothing substituted the configured values, so on a host where another service owns those ports there was no supported way to move nginx off them.

This is not the macOS-only fault it looked like from the plist. The launchd generator builds its -p arguments from the quadlet's PublishPort lines, so it was faithfully reproducing a template both platforms share.

ApplyNginxPorts rewrites the host side of those mappings by matching the container port, leaving 80 and 443 inside the container where nginx listens, and runs before the loopback and IPv6 prefixes are added so it handles either form. A port left unset keeps the bundled default. Both writers call it, since having two of them is how this was missed in the first place, and config.NginxPorts is now the single place the two numbers come from.

Doctor's port section was the visible half of the same problem. It probed the literal 80 and 443, and when nginx was up it reported them as fine without probing at all, so a host with nginx demonstrably on 10080 was told about port 80 either way. It now reports and probes whatever is configured.
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