Repository navigation
fix(site): use a new file for every www check - #517
Merged
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
🟢 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
check_www_or_non_www_domain()wrotecheck.htmlinto the webroot, requestedwww.<site>/check.htmland 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 withee site createfollowed byee site update --ssl=lewithin 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.