Skip to main content
Admin Modules

Branch Deployments

View and test Cloudflare Pages preview deployments for feature branches with admin access bypass

February 25, 2026

Branch Deployments

The Deployments page at /admin/deployments shows all recent Cloudflare Pages deployments — both preview (branch) and production. Its main purpose is letting you test feature branch previews with full admin access before merging.

The Problem It Solves

When Claw or any contributor pushes a feature branch, Cloudflare Pages automatically builds and deploys a preview at <branch>.Arcturus-Prime.pages.dev. However, the Arcturus-Prime middleware blocks /admin/* routes on non-Arcturus-Prime.com hosts and redirects all *.pages.dev traffic to Arcturus-Prime.com.

The middleware has a ?preview parameter bypass: adding ?preview to any pages.dev URL sets a sticky cookie (__argobox_preview=1, 24-hour TTL) that:

  1. Skips the *.pages.devArcturus-Prime.com redirect
  2. Allows /admin/* routes to render on the preview domain
  3. Persists across subsequent page navigations without needing ?preview again

The Deployments page generates preview links with ?preview already appended, so you can click straight through to test admin pages on any branch preview.

Page Layout

Stats Row

Three stat cards at the top:

  • Preview — count of preview deployments in the current result set
  • Production — count of production deployments
  • Branches — unique branch count across preview deploys

Filter Bar

  • Toggle buttons — All / Preview / Production. Filters the deployment list by environment.
  • Search box — Filters by branch name (case-insensitive substring match). Works in combination with the environment filter.

Deployment List

Full-width cards sorted newest-first. Each card shows:

  • Status dot — green (success), red (failure), yellow (building), gray (canceled)
  • Environment badge — blue pill for preview, green pill for production
  • Branch name — bold, primary identifier
  • Time ago — relative time since deployment
  • Commit message — truncated with ellipsis
  • Commit hash — short 7-char hash in orange monospace
  • Action buttons — contextual based on environment and status

Action Buttons

EnvironmentStatusButton
PreviewSuccessOpen Preview — opens <url>?preview in new tab
ProductionSuccessOpen Site — opens production URL
AnyFailure”Build failed” label (no link)
AnyActive”Building…” label with pulse animation

Auto-Refresh

The deployment list refreshes automatically every 60 seconds. Manual refresh via the button in the header.

API

Reuses the existing /api/dashboard/cf-pages endpoint with an increased limit parameter:

GET /api/dashboard/cf-pages?project=Arcturus-Prime&limit=30

The limit parameter (default 5, max 50) controls how many deployments are returned. The endpoint fetches from the Cloudflare API at:

https://api.cloudflare.com/client/v4/accounts/{CF_ACCOUNT_ID}/pages/projects/Arcturus-Prime/deployments

Required env vars: CF_API_TOKEN, CF_ACCOUNT_ID

Module Registration

Registered as the deployments module in src/config/modules/deployments.ts:

Module ID:     deployments
Nav Item:      Deployments (group: dev)
Icon:          fa-rocket
Pages:         /admin/deployments
API Routes:    /api/dashboard/cf-pages
Required Env:  CF_API_TOKEN, CF_ACCOUNT_ID

The ?preview bypass is implemented in src/middleware.ts:

  1. First visit with ?preview on a *.pages.dev domain
  2. Middleware strips the param from the URL
  3. Sets cookie: __argobox_preview=1; Path=/; SameSite=Lax; Secure; Max-Age=86400
  4. Redirects (302) to the clean URL
  5. All subsequent requests on that domain check the cookie and skip both the redirect and the admin route block

The cookie expires after 24 hours. To revoke access early, clear the __argobox_preview cookie.

Workflow: Testing Claw’s Changes

  1. Claw pushes a feature branch to Gitea
  2. Gitea mirrors to GitHub (via push mirror)
  3. Cloudflare Pages auto-builds and deploys a preview
  4. Go to /admin/deployments — new preview appears in the list
  5. Click Open Preview — opens the branch preview with admin access
  6. Test the changes (including admin pages)
  7. Go to /admin/pull-requests — merge or close the PR
  8. Click Sync to GitHub if needed
admindeploymentscloudflarepagespreviewbranchesci-cd