Firebase Hosting Headers Config: Cache, Security, CORS
The headers block in firebase.json controls cache TTL, security policy, and CORS. Here is the minimum config that ships fast and safe — and the patterns that cost you.
Articles tagged with #Hosting
The headers block in firebase.json controls cache TTL, security policy, and CORS. Here is the minimum config that ships fast and safe — and the patterns that cost you.
Edge Functions sound great on the slide deck, but most content sites do not need them. Here is when Edge actually wins, when Node serverless is better, and when static is the right answer.
ISR sounds modern, SSG sounds old, but for a content site the choice is concrete. Here is the actual trade-off in build time, freshness, cost, and rollback.
Deploying a content site from a Turborepo monorepo on Vercel is mostly settings, not magic. Here is the exact root config, ignored builds, and shared package wiring that works.
Vercel / Cloudflare Pages all have a size cap — one bloated dependency can blow it.
Local `npm i` pulls new deps but CF Pages still ships old ones — node_modules cache stuck.
Step-by-step on deploying a static Astro site to Firebase Hosting, with the configuration that avoids the common pitfalls in 2026.
A no-nonsense 2026 walkthrough for shipping a static site (Astro, Vite, plain HTML) to Firebase Hosting in about 10 minutes — including SSL, custom domain, and cache headers.
Deployed but visitors see the old page? Use this firebase.json cache-header config, curl diagnostic, and rollback to flush stale content in seconds.
Add a custom domain to Firebase Hosting with the exact DNS records, dig commands for verification, and the common failures explained.
The Firebase Spark free tier in 2026 gives 10 GB storage + 360 MB/day egress. Use this page-weight math, budget config, and asset checklist to know if you fit.
A 10-item pre-launch checklist for sites going live on Firebase Hosting in 2026 — covering domain, SSL, cache, redirects, sitemap, Search Console, and rollback rehearsal.
Rewrites in Firebase Hosting let you map URLs to functions, Cloud Run, or single-page apps. Here is when each pattern is the right tool — and when rewrites cause more problems than they solve.
Pages that worked locally return 404 on Firebase Hosting. Use this diagnostic checklist with firebase.json snippets and curl commands to pinpoint the cause.
Vercel is famous for Next.js, but it is also excellent for Astro content sites. Use this vercel.json setup, image config, and bandwidth math to decide.
Vercel build failures are usually one of six causes — Node version, env var, type error, dependency, OOM, or stale cache. Match the log, paste the fix.
A pre-launch checklist for content sites going live on Vercel in 2026 — covers Astro / Next.js settings, custom domain, env vars, sitemap, canonical, analytics, and rollback.
Point a custom domain at Vercel with the exact DNS records, dig + curl verification, and Cloudflare-in-front configuration that does not break SSL.
Ship an Astro site on Vercel with the exact astro.config.mjs, vercel.json, CLI commands, and SSL verification — no detours.
Vercel Hobby is free non-commercial; Pro is $20/seat/mo. Use this limits table, project audit script, and budget config to decide.
Firebase Hosting is Google's static + edge CDN service tied to Firebase. Here is when it fits, with the firebase.json baseline and deploy commands.
Vercel is a framework-native platform — first-class for Next.js, Astro, SvelteKit. Get the mental model, sample vercel.json, and a 5-minute deploy.
Decide when to buy a custom domain — with a checklist, WHOIS / trademark commands, and registrar checks that prevent expensive regret.
Pages exist in dev but 404 in prod — almost always `build.format`, trailing slash, or output mode mismatch.
Switched domains but old canonical still appears — config + cache.
SSL pending for hours after domain hookup — usually DNS or CAA.
Vercel / Firebase says deploy ok, but visitors see yesterday's version.
You changed DNS and some users see new, some see old. Here's why and how to test.
Works locally, fails prod — env var not set, or prefix issue (PUBLIC_ / VITE_ / NEXT_PUBLIC_).
Hosting deploy fails — CLI version, quota, or firebase.json config.
After deploying to Firebase Hosting, the homepage works but /about and other subpages return 404? Your firebase.json rewrites are misconfigured. Fixes for SPA, SSG, static multipage, Astro, and Next.js.
Share to LinkedIn / X / Slack and no image shows — meta tag, image size, or cache.
You configured redirects but they don't fire — order, format, host quirks.
You changed robots.txt but Google still crawls / indexes the same URLs.
/rss.xml or /feed.xml 404 — endpoint missing, wrong filename, or host caching.
/sitemap.xml or /sitemap-index.xml returns 404 — integration off or `site` missing.
Images and CSS 404 after deploy but work locally. Five typical causes — missing dist/ copy, base path, content hash, public folder, host upload step.
Browser shows nothing, no error — almost always hydration or JS import failure.
/foo redirects to /foo/ then to /foo (or 308 → 301 chain). Pick one and stick to it.
Site builds but 500s in production — usually serverless function, env vars, or edge runtime.
Build never finishes — typically OOM, dependency deadlock, or build timeout.
Step-by-step 2026 guide to deploying Next.js on Vercel — auto-detection, environment variables, ISR, image optimization, and the App Router gotchas indie devs lose half a day to.
When a Vercel deploy goes red, the log already tells you what's broken — if you know where to look. Three key positions, plus the five most common failure modes.
Both have generous free tiers and great DX. Here's how Firebase Hosting and Vercel differ on serverless, ecosystem, deployment, SEO, and pricing in 2026.