Skip to content

Move the Vue app from Cloudflare Pages to a Worker with static assets #126

Closed

Description

@wormeyman

The Vue app deploys to Cloudflare Pages through .github/workflows/deploy-cloudflare.yml (wrangler-action, command: pages deploy ... --project-name=factoriotools). Cloudflare now says to start new projects on Workers, and it has a guide for moving Pages projects over. Pages is not deprecated, so there is no deadline. This is housekeeping, found by a cross-repo sweep on 2026-09-25.

Guide: https://developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/

What moves

  • src/vue/public/_worker.js becomes the Worker's main. It is a Pages "advanced mode" Worker, and the guide covers this case. Move it out of public/, so it is not also uploaded as an asset. Point main at it, and set "assets": { "directory": "<build>/dist", "binding": "ASSETS" }. The env.ASSETS.fetch calls keep working.
  • The SPA fallback. The script returns the 404.html shell with status 404 for client-side routes like /oil-field. That can stay as it is. The built-in "not_found_handling": "single-page-application" is simpler, but it serves index.html with status 200, which changes what crawlers see. Pick one on purpose.
  • The old-host redirect. The script 301s factoriotools-5jg.pages.dev to oilfieldplanner.factorygamefan.com. A Worker never receives requests for a pages.dev host. So either keep the Pages project alive as a redirect-only stub, or accept that the old host stops redirecting.
  • Workflow: change command: to deploy (plus --config if wrangler.jsonc does not sit next to the build). Pull requests already build without deploying, so that part stays.
  • Domain: oilfieldplanner.factorygamefan.com is a proxied CNAME to the Pages project. Add it as a Custom Domain on the Worker, which replaces that record. Touch no other factorygamefan.com records.
  • Previews. Pages made a preview URL for each branch. For the same on Workers, set "preview_urls": true. That is optional here, since the workflow only deploys main.

Done when

  • https://oilfieldplanner.factorygamefan.com/ and a hard load of /oil-field both work from the Worker.
  • A decision is written down for the factoriotools-5jg.pages.dev redirect.

Activity

  1. wormeyman commented on Sep 26, 2026

    @wormeyman
    CollaboratorAuthor

    Done in #127. oilfieldplanner.factorygamefan.com now serves from the assets-only Worker oilfieldplanner-factorygamefan-com (not_found_handling: 404-page, so client routes like /oil-field still get the app shell with status 404, as on Pages). The deploy on main is green and re-attaches the custom domain. Decision on the old host: the Pages project factoriotools is kept only as a redirect stub, and factoriotools-5jg.pages.dev/* now 301s to the same path and query on the custom domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions