Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Netlify allows configuration for redirects and rewrites with files, e.g. redirects are read from the
A use case for this is having a site generated by a static site generator like Hugo, which allows the use of aliases. Alias redirects are generated by default using HTML redirects. But it's possible to generate a file containing all redirects, so that Netlify for example can already do 301 / 302 HTTP redirects.
Yes, simply generate a generate a Caddy config (JSON, Caddyfile, NGINX, whatever other format you want) that includes the redirects. You can use files with the command line, or you can skip the file thing and go straight to its API. If Netlify has its own config format, then you can write a config adapter for it.
Keep in mind that one design goal of Caddy 2 is to centralize the config to a single place rather than scattering it in different places. It makes for lower maintenance, fewer mistakes, and easier troubleshooting.