Enable path-based URL routing for web deployments - #106
Conversation
- 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 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>
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 |
|
@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>
Done! I've removed the GitHub Pages deployment job from the workflow, removed the |
LCOV of commit
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
🚀 Cloudflare Pages PreviewYour 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. |
There was a problem hiding this comment.
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/_redirectsfile for Cloudflare Pages SPA routing with wildcard fallback toindex.html - Created comprehensive routing documentation in
docs/URL_ROUTING.mdcovering implementation, benefits, and testing - Removed GitHub Pages deployment job and
pages: writepermission 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 |
| @@ -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` | |||
There was a problem hiding this comment.
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.
| - Uses Cloudflare Pages project `cambeerfestival-staging`, branch `main` | |
| - Uses Cloudflare Pages project `staging-cambeerfestival`, branch `main` |
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 sectionDeployment Impact
_redirects--proxyflag (already configured in workflow)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
💡 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.