Skip to content

Publish the managed gateway's ports 80 and 443 only for HTTPS - #271

Merged
SaladDay merged 2 commits into
mainfrom
codex/managed-https-ports
Sep 30, 2026
Merged

SaladDay merged 2 commits into
mainfrom
codex/managed-https-ports

Conversation

@SaladDay

@SaladDay SaladDay commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The managed gateway published host ports 80 and 443 even before any domain was configured, so a host whose port 80 was taken (for example by nginx) could not install at all, although HTTPS is optional and set up later in Web. Domain setup only discovered port or DNS problems after a 180 s certificate verification timeout, with one lumped message.

What

  • ingress_config.published(config, candidate=None) always publishes ports.web, and adds 80/443 only when public_url is set or a domain candidate is being verified. The single listener derivation follows, so:

    • a default install with port 80 taken succeeds;
    • --public-url installs still check 80/443 up front;
    • oac apply checks them when HTTPS turns on.
  • Domain setup (ingress.prepare, used by Web and oac domain) runs fast checks before reserving a job, each returning a 409:

    • hostname_unresolved when the hostname has no A/AAAA record;
    • https_ports_unavailable naming the busy port(s).

    The gateway's own ports never count, so a domain change with HTTPS already on passes.

  • The attempt recreates the gateway with 80/443 through the common apply path, keeping Core and Web on the applied address until verification succeeds. A failed attempt restores the gateway without 80/443.

  • The verification-failure message now names DNS, firewall/NAT and certificate causes.

  • Docs: the Ports section of install-options.md owns the fact; install, operations, configuration, the installer README and the printed next steps link to it.

Web shows the new 409s through the existing "not accepted" alert with details. No apps/web change.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@SaladDay
SaladDay force-pushed the codex/managed-https-ports branch from 7e0d138 to 9c757f0 Compare September 30, 2026 08:54
@SaladDay
SaladDay force-pushed the codex/managed-https-ports branch from 9c757f0 to 54c5151 Compare September 30, 2026 09:02
@SaladDay
SaladDay merged commit 106cddf into main Sep 30, 2026
1 check passed
The gateway publishes ports.web always, and 80 and 443 once public_url is
set or while domain setup verifies a candidate address
(ingress_config.published). configuration.listeners follows, so a new
installation checks 80 and 443 only with --public-url and oac apply
checks them when public_url turns HTTPS on.

Domain setup (Web and oac domain) checks, before it reserves a job, that
the hostname resolves (hostname_unresolved, 409) and that no other
program holds 80 or 443 (https_ports_unavailable, 409). The installation's
own listeners include those of the written gateway, so a domain change
with HTTPS on, or a retry after an interrupted attempt, never fails on
the gateway's own ports. The attempt renders the candidate through the
common apply, which recreates the gateway with 80 and 443 before Caddy
verifies it; failure restores the gateway without them. The
verification failure message now names DNS, firewall or NAT, and the
certificate request as its causes.

The fake host's listening table includes the ports running containers
publish.
Domain setup returns Core to the applied address before it switches, so
prepare confirms a public URL change from there, and the final apply makes
the change prepare confirmed. A retry after a switch interrupted with Core
already on the new address no longer fails after verification.

The written gateway ports count as the installation's own only while the
gateway runs with the written inputs. oac start keeps an unfinished domain
setup recorded, so its status reports the interruption, and that message
says what oac apply does. A failure in the candidate apply reaches Web as
the domain setup message. DNS resolves the hostname as an absolute name.
The interrupted-retry test now stops the switch itself, before and after
Core restarts.
@SaladDay
SaladDay deleted the codex/managed-https-ports branch October 7, 2026 06:38
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