# ---------------------------------------------------------------------------- # jb-website — Caddy site config. # # Routing model (see docs/planning.md §6.2): # joshbairstow.com -> /srv/* (apex / home) # blog.joshbairstow.com -> /srv/blog/* (writing archive + posts) # art.joshbairstow.com -> /srv/art/* (generative art focus view) # code.joshbairstow.com -> /srv/code/* (experiments & tools) # # Each block points at the same /srv directory but uses `root` with the path # prefix appropriate to the subdomain. Caddy handles HTTPS via the automatic # ACME / Let's Encrypt flow at the email address below. # # Local dev: see the `localhost` block at the bottom — Caddy listens on :8080 # with no TLS so `docker compose up` works out of the box on a laptop. # ---------------------------------------------------------------------------- { # Replace with the address you want ACME-challenge contact / cert-expiry mail at. email josh@joshbairstow.com } # ---- apex ------------------------------------------------------------------ joshbairstow.com, www.joshbairstow.com { root * /srv encode zstd gzip file_server try_files {path} {path}/index.html /404.html @www host www.joshbairstow.com redir @www https://joshbairstow.com{uri} permanent } # ---- blog ------------------------------------------------------------------ blog.joshbairstow.com { root * /srv/blog encode zstd gzip # Assets and the canvas-island JS live at /_astro and /assets on the apex build. # Re-route them from the subdomain root by falling through to the parent /srv. @asset path /_astro/* /assets/* handle @asset { root * /srv file_server } handle { file_server try_files {path} {path}/index.html /srv/404.html } } # ---- art ------------------------------------------------------------------- art.joshbairstow.com { root * /srv/art encode zstd gzip @asset path /_astro/* /assets/* handle @asset { root * /srv file_server } handle { file_server try_files {path} {path}/index.html /srv/404.html } } # ---- code ------------------------------------------------------------------ code.joshbairstow.com { root * /srv/code encode zstd gzip @asset path /_astro/* /assets/* handle @asset { root * /srv file_server } handle { file_server try_files {path} {path}/index.html /srv/404.html } } # ---- local dev (no TLS) ---------------------------------------------------- # Hit http://localhost:8080 to preview the built apex; the subdomain rewrites # above only fire when accessed by their real hostnames. :8080 { root * /srv encode zstd gzip file_server try_files {path} {path}/index.html /404.html }