Subfolder with Astro
An Astro build is static files — the /blog proxy lives on whatever serves them.
First enable Settings → Subfolder hosting in the dashboard. Then add the proxy where your Astro site is hosted:
- Hosted on Vercel → use the vercel.json from the Vercel guide.
- Hosted on Netlify → use the netlify.toml from the Netlify guide.
- Hosted on Render → add the two rewrite rules from the Render guide.
- Your own server → the Nginx or Apache guide.
- Anything else behind Cloudflare DNS → the Cloudflare Worker guide.
For local development, Astro exposes Vite's dev proxy:
astro.config.mjsimport { defineConfig } from "astro/config";
export default defineConfig({
vite: {
server: {
proxy: {
"/blog": {
target: "https://you.blogcms.app",
changeOrigin: true,
rewrite: (p) => p.replace(/^\/blog/, "/_subfolder"),
},
},
},
},
});