Skip to content

Enable path-based URL routing for web deployments - #106

Merged
richardthe3rd merged 7 commits into
mainfrom
copilot/update-routing-method-to-path
Dec 7, 2025
Merged

Enable path-based URL routing for web deployments#106
richardthe3rd merged 7 commits into
mainfrom
copilot/update-routing-method-to-path

Conversation

Copilot AI commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

The web app was using hash-based URLs (/#/favorites) instead of path-based URLs (/favorites). While go_router 14.6.2+ defaults to path-based routing in Flutter, web servers need explicit SPA fallback configuration.

Changes

  • web/_redirects: Cloudflare Pages SPA routing config (/* /index.html 200)
  • docs/URL_ROUTING.md: Routing strategy documentation (includes http-server proxy setup for local dev)
  • README.md: Added Architecture & Documentation section
  • Removed GitHub Pages deployment: Cleaned up legacy GitHub Pages deployment job and all references across documentation to avoid confusion

Deployment Impact

  • Cloudflare Pages (production/staging): Full path-based routing via _redirects
  • Local Development: http-server handles SPA routing via --proxy flag (already configured in workflow)
  • GitHub Pages: Removed entirely - no longer used for deployment
  • Existing hash URLs continue to work via go_router's automatic migration

Benefits

Clean, shareable URLs that support SEO, deep linking, and standard web behavior. Simplified deployment strategy with all environments using Cloudflare Pages exclusively.

Original prompt

Can we use path based routing instead of hash based?


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits December 7, 2025 10:54
- Add _redirects file for Cloudflare Pages SPA routing
- Add 404.html fallback for GitHub Pages deployment
- These files enable path-based routing (e.g., /favorites) instead of hash-based routing (e.g., /#/favorites)
- go_router 14+ already uses path-based URLs by default, these files configure the web servers to support it

Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>
- Add docs/URL_ROUTING.md explaining routing strategy
- Update README.md with Architecture & Documentation section
- Document both Cloudflare Pages and GitHub Pages configurations

Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>
- Update go_router version to match pubspec.yaml (14.6.2)
- Simplify 404.html to remove unused sessionStorage code
- Document GitHub Pages limitation for direct route links

Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>
Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>
Copilot AI changed the title [WIP] Update routing method from hash to path based Enable path-based URL routing for web deployments Dec 7, 2025
Copilot AI requested a review from richardthe3rd December 7, 2025 11:02
@richardthe3rd

Copy link
Copy Markdown
Owner

@copilot We don't use GitHub pages (I mean we do, but that is legacy and can be removed). I thought nodes http_server did SPA correctly?

- Remove web/404.html (GitHub Pages is legacy, not needed)
- Update docs/URL_ROUTING.md to document http-server's --proxy flag for local dev
- Keep web/_redirects for Cloudflare Pages (production/staging)

Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>

Copilot AI commented Dec 7, 2025

Copy link
Copy Markdown
Contributor Author

@copilot We don't use GitHub pages (I mean we do, but that is legacy and can be removed). I thought nodes http_server did SPA correctly?

You're absolutely right! I've removed the 404.html file since GitHub Pages is legacy, and updated the documentation to explain that http-server handles SPA routing via the --proxy flag (which the workflow already uses). The _redirects file remains for Cloudflare Pages. Changes in commit b21490a.

@richardthe3rd

Copy link
Copy Markdown
Owner

@copilot Let's remove the publish to gh pages and all references to gh pages to stop confusing ourselves

- Remove deploy-web job from build-deploy.yml workflow
- Remove pages: write permission from workflow
- Update README.md to remove GitHub Pages environment
- Update docs/CICD.md to remove GitHub Pages references
- Update docs/CLOUDFLARE_PAGES_SETUP.md deployment table
- Update AGENTS.md deployment description
- Update cloudflare-worker/README.md description
- Update docs/PLAY_STORE_METADATA.md privacy policy hosting options

GitHub Pages was legacy and no longer used for deployment. All deployments now go through Cloudflare Pages (production, staging, and PR previews).

Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>

Copilot AI commented Dec 7, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Let's remove the publish to gh pages and all references to gh pages to stop confusing ourselves

Done! I've removed the GitHub Pages deployment job from the workflow, removed the pages: write permission, and cleaned up all references to GitHub Pages across the documentation. All deployments now use Cloudflare Pages exclusively (production, staging, and PR previews). Changes in commit e3c7e18.

@github-actions

github-actions Bot commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

LCOV of commit e3c7e18 during Flutter App CI/CD #510

Summary coverage rate:
  lines......: 58.2% (1255 of 2157 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a

@codecov

codecov Bot commented Dec 7, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

🚀 Cloudflare Pages Preview

Your preview deployment is ready!

Preview URL: https://copilot-update-routing-metho.staging-cambeerfestival.pages.dev

This preview will be automatically updated when you push new commits to this PR.

@richardthe3rd
richardthe3rd marked this pull request as ready for review December 7, 2025 13:42
Copilot AI review requested due to automatic review settings December 7, 2025 13:42
@richardthe3rd
richardthe3rd merged commit 6eaec27 into main Dec 7, 2025
22 of 30 checks passed
@richardthe3rd
richardthe3rd deleted the copilot/update-routing-method-to-path branch December 7, 2025 13:43

Copilot AI 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.

Pull request overview

This pull request enables path-based URL routing for the web application by adding Cloudflare Pages SPA fallback configuration and removing the legacy GitHub Pages deployment. The changes migrate from hash-based URLs (/#/favorites) to clean path-based URLs (/favorites) using go_router 14.6.2+'s default behavior combined with server-side routing configuration.

Key changes:

  • Added web/_redirects file for Cloudflare Pages SPA routing with wildcard fallback to index.html
  • Created comprehensive routing documentation in docs/URL_ROUTING.md covering implementation, benefits, and testing
  • Removed GitHub Pages deployment job and pages: write permission from the workflow
  • Updated all deployment documentation to reflect Cloudflare Pages as the exclusive deployment platform

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
web/_redirects Cloudflare Pages SPA routing configuration with wildcard redirect to index.html
docs/URL_ROUTING.md New comprehensive documentation explaining path-based routing implementation, benefits, and testing
docs/PLAY_STORE_METADATA.md Updated privacy policy hosting references from GitHub Pages to Cloudflare Pages
docs/CLOUDFLARE_PAGES_SETUP.md Removed GitHub Pages deployment references from deployment architecture table
docs/CICD.md Removed deploy-web job documentation and updated deployment flow descriptions
cloudflare-worker/README.md Simplified description by removing specific GitHub Pages reference
README.md Added Architecture & Documentation section, removed GitHub Pages deployment environment, updated deployment strategy
AGENTS.md Updated CI/CD pipeline description to reflect Cloudflare Pages deployments
.github/workflows/build-deploy.yml Removed deploy-web job and pages:write permission

Comment thread README.md
@@ -150,18 +159,14 @@ The app is deployed to multiple environments:
- Deployed automatically on push to `main`
- Uses Cloudflare Pages project `cambeerfestival-staging`, branch `main`

Copilot AI Dec 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistency detected: The documentation states the Cloudflare Pages project should be named cambeerfestival-staging, but the actual workflow in .github/workflows/build-deploy.yml line 273 uses staging-cambeerfestival. This mismatch could cause deployment failures. Please verify the correct project name in Cloudflare and update the documentation accordingly, or update the workflow to match the documented name.

Suggested change
- Uses Cloudflare Pages project `cambeerfestival-staging`, branch `main`
- Uses Cloudflare Pages project `staging-cambeerfestival`, branch `main`

Copilot uses AI. Check for mistakes.
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.

3 participants