Skip to content

fix(migration): keep a site whose Let's Encrypt certificate is pending on HTTP - #1955

Merged
mrrobot47 merged 4 commits into
EasyEngine:developfrom
mrrobot47:fix/migration-keep-pending-ssl-on-http
Nov 16, 2026
Merged

mrrobot47 merged 4 commits into
EasyEngine:developfrom
mrrobot47:fix/migration-keep-pending-ssl-on-http

Conversation

@mrrobot47

@mrrobot47 mrrobot47 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

What

The image migration regenerates each affected site's docker-compose.yml in SiteContainers::generate_site_docker_compose_file() and decided HTTPS only from site_ssl. It now also keeps a site on plain HTTP while its Let's Encrypt certificate is pending.

Why

EasyEngine/site-command#521 adds a pending Let's Encrypt state: after a manual DNS-01 challenge (no Cloudflare API key) the site keeps site_ssl = le but has no certificate until ee site ssl-verify issues it, and the site is served over HTTP meanwhile. An image migration that touched such a site turned HTTPS back on, so nginx-proxy redirected it to HTTPS and served it with the closest matching certificate of another site (e.g. the parent domain's) until ssl-verify ran.

The check is site-command's own \EE\Site\Utils\is_le_ssl_pending(), the same one refresh and update --php use in #521. It is called only when it exists: with a site-command that doesn't have it (the current release), the migration behaves exactly as before.

Note: a site left pending by an older site-command (HTTPS still on in its compose file, WordPress URLs on https://) is switched to HTTP by the migration once #521 is in, the same as ee site refresh does with #521. Moving such sites' WordPress URLs along is a separate follow-up.

Depends on / pairs with

How tested

  • Unit tests (PHPUnit, PHP 7.4 and 8.5) for the HTTPS state written by generate_site_docker_compose_file(): no SSL, LE with and without certificate files (crt only, key only), self/custom/inherit, and the fallback without the helper. Run against site-command develop and Databases not dropping properly - weakly-referenced object no longer exists #521; with Databases not dropping properly - weakly-referenced object no longer exists #521 they fail on develop's code.
  • E2E on GitHub Actions (run; Pebble as the ACME server, PHP 7.4 and 8.5): a pending html site and a pending WordPress site (manual DNS-01, site-command#521 + site-type-wp#247) and an html site with an issued certificate (HTTP-01), a certificate for the parent domain present, then every site's nginx moved to an older tag and the real migration triggered:
    • this branch: both pending sites stay nohttps, answer 200 over HTTP and aren't served with the parent's certificate, WordPress home stays http://; the issued site keeps HTTPS (200, Pebble certificate, HTTP redirects to HTTPS); ee site ssl-verify afterwards turns HTTPS on for the pending site.
    • develop's SiteContainers.php with the same packages: the migration removes nohttps from both pending sites and HTTP redirects to HTTPS served with the parent domain's certificate.
    • this branch with site-command/site-type-wp develop: unchanged behaviour (pending sites keep HTTPS on, as before), no errors.

Summary by CodeRabbit

  • Bug Fixes
    • Improved site setup for HTTPS: sites without an SSL certificate, or with a certificate still pending, are configured to serve without HTTPS. Sites with an available certificate continue to use HTTPS.

…g on HTTP

The image migration regenerated each site's docker-compose.yml with HTTPS on whenever site_ssl was set. A site waiting for `ee site ssl-verify` after a manual DNS-01 challenge has site_ssl=le but no certificate yet, so nginx-proxy then served it over HTTPS with the closest matching certificate of another site.

Use site-command's is_le_ssl_pending() when it exists, the same check refresh and `update --php` use. Older site-command versions don't have it and keep the previous behaviour.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change preserves backward compatibility and has no identified blocking issues.

No open issues 🎉

What changed in this PR

Keeps sites with pending Let's Encrypt certificates on HTTP when image migrations regenerate their Docker Compose configuration.

Changes:

  • Uses the site-command pending-certificate helper to determine whether HTTPS should remain disabled.
  • Preserves existing behavior when the helper is unavailable or the site has no SSL configured.
File Description
php/​EE/​Migration/​SiteContainers.php Adds a backward-compatible HTTPS decision helper for site Compose regeneration.

Review effort: Balanced

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Site compose HTTPS option

Layer / File(s) Summary
Determine the HTTPS option
php/EE/Migration/SiteContainers.php
The compose dump uses is_served_without_https to set nohttps. The helper returns true when site_ssl is empty, or when the pending-SSL utility exists and reports a pending certificate.

Change: Bug fix

Merge Risk: Minimal · up to 8709b

Sites awaiting a Let's Encrypt certificate stay on HTTP during image migration. Older site-command versions keep the previous behavior. No merge-blocking risk was identified.

Security architecture risk: Minimal · up to 8709b

This is a narrow correction to certificate-readiness handling, with unchanged behavior when pending-certificate support is unavailable. The inspected change did not establish a new security or recovery defect.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — A migration can update transport policy for multiple affected sites on one installation, including saved compose files for disabled sites. The newly different behavior is conditional on a positive pending-state result for each configured-SSL site. A site's aliases share its nginx transport policy.

Trust Boundaries and Controls

  • inferred — The inspected caller supplies site identity and SSL configuration from the sites database, not from a newly added network input. Certificate readiness is delegated to installed site-command code. Public PHP visibility alone does not establish a remotely reachable entrypoint or an authorization bypass.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4cd23d35-7726-4b64-a4c6-fc6f0e1d0af5
Commits

Reviewing files that changed from the base of the PR and between f5575e9 and 8709b9b.

Files selected for processing: 1

  • php/EE/Migration/SiteContainers.php

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@mrrobot47
mrrobot47 merged commit 62229f2 into EasyEngine:develop Nov 16, 2026
32 checks passed
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.

2 participants