fix: local connectivity check fails on valid networks (302 redirect)#8
Conversation
checkPlaygroundConnectivity() HEAD-fetched downloads.w.org, which 302-redirects to wordpress.org/download/. Following that redirect is fragile: on some networks the HEAD-follow errors out, and a GET-follow downloads the full target page and times out — so `instawp local create` reported "Cannot reach WordPress download servers" despite working connectivity (curl -I and https.get, neither of which follow the redirect, both succeed). Fix: add redirect:'manual' to both reachability probes. Any response (including the 302) proves the host is reachable, which is all the check needs — matching curl -I / https.get behaviour. Smallest change; existing "no throw => reachable" logic is unchanged. Reproduced locally on Node 22: HEAD-follow OK but GET-follow ETIMEDOUT; HEAD/GET with redirect:'manual' both return 302 fast. Verified the patched probe returns null (reachable). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
QA: PASS ✅Env: local build from PR head · Criteria: Result — step by step
Why the fix is correct (direct probe evidence on this box)Comparing the old (follow) vs new ( The HEAD-follow of the 302 actually threw here on Repro-before-fix: Not reproduced on this box's network — the primary probe ( Note: the repo has pre-existing — QA |

Problem
instawp local createfails with "Cannot reach WordPress download servers" even when the user has working connectivity and can reach the WordPress download servers (task 858b3035).Root cause
checkPlaygroundConnectivity()(src/lib/local-env.ts) probeddownloads.w.orgwith aHEADfetch. That host 302-redirects towordpress.org/download/, andfetchfollows redirects by default. Following the redirect is the fragile part:wordpress.org/download/and times out (reproduced here on Node 22.22 →ETIMEDOUT).The tools that work for the reporter —
curl -Iand Nodehttps.get()— succeed precisely because neither follows the redirect. The check only needs to know the host answers, so following the redirect is both unnecessary and the source of the failure.Fix
Add
redirect: 'manual'to both reachability probes (downloads.w.organd thedownloads.wordpress.orgfallback). Any response — including the 302 — proves the host is reachable, which is exactly what the check tests. The existing "no throw ⇒ reachable" logic is unchanged; this is the smallest correct change (2 lines + a comment).Note: the originally-suggested "switch HEAD→GET" would have made it worse — GET follows the redirect and downloads the whole target page (times out).
redirect: 'manual'fixes it independent of method.Verification
Reproduced on Node 22.22:
Patched
checkPlaygroundConnectivity()returnsnull(reachable). Cross-model review (GLM-4.6): no blocking issues. Full vitest suite couldn't run in the sandbox (partial dep install — read-only npm cache), but this change touches no existing test and adds no type surface (redirectis a standardRequestInitfield).Next step (human):
/code-review ultra <PR#>before merge.