Serve your Hatch blog from a subfolder like /blog
Mount your Hatch Astro frontend at yoursite.com/blog with Nginx, Caddy, Vercel rewrites, Cloudflare Pages redirects or a Worker proxy, step by step.
Last updated October 29, 2026
By the end of this guide your Hatch blog will appear at yoursite.com/blog on the same domain as your existing marketing site, served by your Hatch frontend behind the scenes.
How it works
Your marketing site keeps serving yoursite.com. When a visitor opens any /blog/* path, your host reverse-proxies or rewrites the request to the Hatch frontend. The visitor never sees the frontend’s own address. A subfolder keeps your blog on the same domain, which consolidates search authority better than a subdomain. The Hatch frontend itself always runs on Cloudflare Workers.
In every setup below, replace https://your-hatch-frontend.workers.dev with the frontend address shown on the Hatch Connection tab.

Option 1: your own server with Nginx or Caddy
- In the marketing site’s Nginx
serverblock, add alocation /blog/block before the catch-alllocation /. - Inside it,
proxy_passto your frontend address, turn onproxy_ssl_server_name, and set theX-Forwarded-Hostheader to your domain. - Add
sub_filterrules that rewritehref="/andsrc="/to the/blog/prefix, withsub_filter_once off. - Test and reload:
sudo nginx -t && sudo systemctl reload nginx.
With Caddy, use handle_path /blog/* and reverse_proxy to your frontend. handle_path strips the /blog/ prefix before proxying, so the frontend sees /hello-world while the visitor sees /blog/hello-world. Reload with sudo caddy reload --config /etc/caddy/Caddyfile.
Option 2: marketing site on Vercel
- In the marketing site’s
vercel.json, add two rewrites:/blogto your frontend address, and/blog/:path*to your frontend address plus/:path*. - Redeploy the marketing site. The rewrites take effect on the next build.
If CSS or JavaScript files fail to load, the frontend may need to emit paths that start with /blog; this is set with basePath in the Astro config.
Option 3: Cloudflare
Marketing site on Cloudflare Pages: add two lines to its public/_redirects file that send /blog and /blog/* to your frontend with status 200. A 200 means Cloudflare proxies the response instead of redirecting the browser, so the address bar stays on your domain.
Marketing site elsewhere: put your domain on Cloudflare (the free plan is enough) and deploy a small Worker on the route yoursite.com/blog/*. It strips the /blog prefix, fetches the same path from your Hatch frontend, and returns the response.
Tell Hatch about the subfolder
- Open Hatch, then the Connection tab.
- Keep the frontend address set to the frontend’s own address, for example the workers.dev address.
- Set the Site URL to
https://yoursite.com/blog. This makes Hatch emit canonical URLs that point at the public/blogpath, not the proxy origin.
Check it
- Open
yoursite.com/blogand a few posts. - Open your browser’s developer tools and confirm styles, scripts and images load without errors.
- View the page source and check the canonical link uses
/blog.