๐๐๐๐ฟ๐ผ + ๐๐น๐ผ๐๐ฑ๐ณ๐น๐ฎ๐ฟ๐ฒ ๐ฃ๐ฎ๐ด๐ฒ๐: ๐ฏ ๐๐ฒ๐ฝ๐น๐ผ๐ ๐๐๐ด๐
I built a static Astro site on Cloudflare Pages. I hit three bugs. These bugs cost me hours. Use these tips to save your time.
Bug 1: Trailing Slashes I set trailingSlash to never. Cloudflare added slashes automatically. Google Search Console showed redirect errors. The canonical URL did not match the live URL. Fix: Set trailingSlash to always.
Bug 2: Redirect Files I used the _redirects file for a domain redirect. Cloudflare rejected the deploy. Absolute URLs no longer work in this file. Fix: Delete the _redirects file. Use Redirect Rules in the Cloudflare dashboard.
Bug 3: Stale Cache I changed how the site builds. Some pages showed 404 errors. Cloudflare kept old redirect paths. Fix: Push a new commit. This forces a full rebuild.
Lessons:
- Pick one URL style and stay with it.
- Use the dashboard for domain redirects.
- Check Google Search Console weekly.
Source: https://dev.to/mikecube/astro-cloudflare-pages-3-deploy-bugs-youll-probably-hit-3e5o