Skip to content

fix(site): use a new file for every www check - #517

Merged
mrrobot47 merged 1 commit into
EasyEngine:developfrom
mrrobot47:fix/www-check-stale-file
Oct 12, 2026
Merged

mrrobot47 merged 1 commit into
EasyEngine:developfrom
mrrobot47:fix/www-check-stale-file

Conversation

@mrrobot47

Copy link
Copy Markdown
Member

check_www_or_non_www_domain() wrote check.html into the webroot, requested www.<site>/check.html and deleted the file. The site's nginx caches open files for 2 minutes (open_file_cache_valid 2m), so a second www check of the same site within 2 minutes got the first check's deleted file and failed. This happened with ee site create followed by ee site update --ssl=le within 2 minutes: the redirect conf was removed and the certificate was issued without the www name, and nothing was logged.

Each check now uses its own file name, ee-www-check-<16 hex>.html, and a failed check logs the URL, the HTTP code, the final URL and the curl error. No image change is needed.

Tested with PHPUnit (a proxy that serves a path's first content again, like nginx; fails before the fix on PHP 7.4 and 8.5, passes after) and live against the real stack: an update right after create now passes the check and leaves no check file.

The www/non-www check wrote `check.html` into the webroot, curled it through the www name and deleted it. The site's nginx (easyengine/nginx) caches open files for 2 minutes (`open_file_cache ... valid 2m`), so a second check within 2 minutes got the first check's deleted file back and failed. This hit `ee site update --ssl=le` right after `ee site create`: no www redirect conf and no www name on the certificate. Self-signed updates hid it, as they count as wildcard.

Each check now uses its own `ee-www-check-<random>.html`, and a failed check logs the HTTP status and the final URL.

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 correctly avoids cached filenames and preserves cleanup behavior.

0 open findings

What changed in this PR

Prevents stale nginx file-cache results during repeated www-domain checks.

Changes:

  • Uses a unique check filename per request.
  • Logs detailed curl diagnostics when checks fail.
File Description
src/​helper/​class-ee-site.php Adds unique probe files and failure diagnostics.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mrrobot47
mrrobot47 merged commit 514cac9 into EasyEngine:develop Oct 12, 2026
3 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