Skip to content

[miniflare] Point HTTPS-CA test at a stable URL#13973

Merged
petebacondarwin merged 2 commits into
mainfrom
pbd/miniflare/fix-https-test-broken-url
May 19, 2026
Merged

[miniflare] Point HTTPS-CA test at a stable URL#13973
petebacondarwin merged 2 commits into
mainfrom
pbd/miniflare/fix-https-test-broken-url

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented May 19, 2026

Copy link
Copy Markdown
Contributor

No tracked issue; this fixes a CI-blocking regression on `main`.

What

The `Miniflare: HTTPS fetches using browser CA certificates` test at `packages/miniflare/test/index.spec.ts:1566` was fetching `https://workers.cloudflare.com/cf.json\` from inside a worker and asserting `res.ok === true` to verify that workerd trusts public CAs.

That URL now permanently 301s to `https://www.cloudflare.com/cf.json\` which returns 404 with the body `not found :(`:

$ curl -sL -w "\nFinal URL: %{url_effective}\nStatus: %{http_code}\n" https://workers.cloudflare.com/cf.json
not found :(
Final URL: https://www.cloudflare.com/cf.json
Status: 404

fetch() follows the redirect by default, so the worker sees the 404. `res.ok` is false. The test fails on every CI run regardless of the change under test, blocking all PRs touching anything in the packages-and-tools matrix (e.g. #13971).

How

Switch the test to fetch `https://example.com/\` — the IANA-maintained stable test endpoint — which serves 200 OK over HTTPS with a public CA chain. The test still exercises the original behaviour it was written to verify (workerd trusting the system/public CA store) without depending on a Cloudflare-controlled URL whose lifecycle is outside this repo.

I considered keeping a Cloudflare-owned URL (e.g. `https://www.cloudflare.com/\` returns 200) but `example.com` is purpose-built for this kind of test and won't quietly disappear.

Test plan

  • `pnpm -F miniflare test:ci test/index.spec.ts -t 'HTTPS fetches using browser'` ✅ (passes locally on macOS)
  • `pnpm check:lint` ✅
  • `pnpm check:format` ✅
  • `validate-changesets.ts` ✅

Note on `packages/miniflare/src/cf.ts`

The same `https://workers.cloudflare.com/cf.json\` URL is also hard-coded as `defaultCfFetchEndpoint` in `packages/miniflare/src/cf.ts:49`. That code already falls back to `fallbackCf` on fetch failure so it's degraded but not broken at runtime — and updating it is out of scope for this minimal CI-unblocker. Worth a follow-up to point it at the correct URL (or strip it entirely if cf.json is no longer published).


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because: this PR is the fix to a broken test — running the affected test under vitest verifies it.
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: test-only fix, no user-facing behaviour change.

Open in Devin Review

`packages/miniflare/test/index.spec.ts` had a test that fetched
`https://workers.cloudflare.com/cf.json` from inside a worker and
asserted `res.ok === true` to verify that workerd trusts public CAs.
That URL now permanently 301s to `https://www.cloudflare.com/cf.json`
which returns 404 `not found :(`. Following the redirect produces a
non-OK response and the test fails on every CI run regardless of the
change under test, blocking all PRs touching anything in the
packages-and-tools matrix.

Switch the test to `https://example.com/` — the IANA-maintained stable
test endpoint — which serves a 200 over HTTPS with a public CA chain
and so still exercises the original behaviour the test was written to
verify.
@changeset-bot

changeset-bot Bot commented May 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2326536

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@workers-devprod workers-devprod requested review from a team and james-elicx and removed request for a team May 19, 2026 15:32
@workers-devprod

workers-devprod commented May 19, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@ask-bonk

ask-bonk Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@github-actions

Copy link
Copy Markdown
Contributor

✅ All changesets look good

devin-ai-integration[bot]

This comment was marked as resolved.

Comment thread .changeset/fix-miniflare-https-test-broken-url.md Outdated

@workers-devprod workers-devprod 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.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk May 19, 2026
@petebacondarwin petebacondarwin added the ci:no-changeset-required Skip pull request checks for a valid changeset label May 19, 2026

@ascorbic ascorbic 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.

I think the missing cf.json is a bigger issue, but shouldn't block this

@pkg-pr-new

pkg-pr-new Bot commented May 19, 2026

Copy link
Copy Markdown
create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13973

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13973

miniflare

npm i https://pkg.pr.new/miniflare@13973

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13973

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13973

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13973

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13973

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13973

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@13973

wrangler

npm i https://pkg.pr.new/wrangler@13973

commit: 2326536

@petebacondarwin petebacondarwin enabled auto-merge (squash) May 19, 2026 15:50
@petebacondarwin petebacondarwin merged commit 304d498 into main May 19, 2026
63 of 65 checks passed
@petebacondarwin petebacondarwin deleted the pbd/miniflare/fix-https-test-broken-url branch May 19, 2026 15:51
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:no-changeset-required Skip pull request checks for a valid changeset

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants