Skip to content

Docs: running the snippet locally with Wrangler - #69

Merged
robstradling merged 1 commit into
mainfrom
readme-wrangler
Nov 16, 2026
Merged

robstradling merged 1 commit into
mainfrom
readme-wrangler

Conversation

@robstradling

Copy link
Copy Markdown
Member

Summary

Adds a "Running the snippet locally" subsection under Testing (and to the contents), describing how to run cf_ctreq.min.js with npx wrangler dev, in front of a real log:

npx wrangler dev cf_ctreq.min.js --compatibility-date=2026-11-01 --local-upstream tiger2027h1.ct.sectigo.com --upstream-protocol https

It notes that the snippet sees the log's hostname (so CONFIG.logEnvironments applies as deployed), but that Wrangler runs it as a Worker, so the limits specific to Snippets (CPU time, and error 1201) aren't enforced; that forwarded requests are real submissions; and that .wrangler/ is ignored by Git.

Validation

With Wrangler 4.162.0 (no Cloudflare login needed), against Tiger2027h1 (where CF_CTreq is disabled):

  • Invalid JSON: the snippet's invalid-json rejection; OPTIONS: 405 (Tiger's trillian environment); get-sth: passed through.
  • Google's monitoring chain with a corrupted signature: forwarded, and rejected by the log with its own 400; an already-logged chain: forwarded, 200 with its existing SCT.
  • --upstream-protocol https is needed: without it, forwarded requests went to the log over plain HTTP and got a 301.

Describe how wrangler dev can run cf_ctreq.min.js in front of a real log (--local-upstream, with --upstream-protocol https), and that it doesn't enforce the limits that only apply to Snippets, such as error 1201.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@robstradling
robstradling merged commit faf60b5 into main Nov 16, 2026
17 checks passed
@robstradling
robstradling deleted the readme-wrangler branch November 16, 2026 12:32
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.

1 participant