Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read redirects from file #3037

jlelse opened this issue Feb 12, 2020 · 1 comment

Read redirects from file #3037

jlelse opened this issue Feb 12, 2020 · 1 comment


Copy link

@jlelse jlelse commented Feb 12, 2020

Netlify allows configuration for redirects and rewrites with files, e.g. redirects are read from the _redirects file in the root folder. Is something similar possible with Caddy 1 / 2 too?

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.


This comment has been minimized.

Copy link

@mholt mholt commented Feb 12, 2020

Is something similar possible with Caddy 1 / 2?

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.

@mholt mholt closed this Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.