A collection of Caddy recipes

Hello, everyone!

I am a long-time Caddy user, and I have collected on my personal wiki some recipes (in the sense of the Perl Cookbook) for how to do this or that with Caddy. I thought I’d share them with others. The recipes range from the basic (how to reverse proxy generic non-PHP FastCGI) to the pretty advanced (how to serve Markdown as adequately pretty HTML—this has turned into a GitHub project). I considered creating a wiki on the forum, but sorry, I’d rather not maintain things in two places.

(My wiki itself is Fossil SCM behind Caddy as the reverse proxy. Caddy handles the TLS and wiki page redirects, which Fossil doesn’t support. It works pretty well.)

Right now the recipes are:

  • “Having multiple sites in separate files (Caddyfile.d)”
  • “Overriding an error status code”—thanks to @francislavoie for helping me with this one!
  • “Redirecting a query parameter to a path”—this proved important for having nice URLs with the Fossil SCM wiki
  • “Reverse-proxying everything except some static files”—self-explanatory
  • “Reverse-proxying generic non-PHP FastCGI”—also self-explanatory
  • “Reverse-proxying SCGI”—a plugin link
  • "Reverse-proxying WeeChat—a link to a WeeChat wiki page; I have updated it for Caddy 2
  • “Running CGI scripts”—a link to my GitHub project
  • “Serving Markdown files as pages”—a link to another GitHub project of mine
  • “Showing an error page on errors”—a template for handle_errors

Feedback is very welcome! Tell me if you have any criticism and/or if you find any of the recipes useful.

1 Like

That’s kinda what the Wiki - Caddy Community is meant to be. A place for community maintained examples and articles.

I’d use it, but as I said, I just don’t want to maintain two copies of my recipes (on my wiki and here). Sorry!

Well, that just adds fragmentation to the Caddy community in general, that I’d prefer to avoid. Keeping things in a few predictable locations makes it much easier to find relevant information for the public.

I understand not wanting to fragment your information. The problem is, I don’t want to fragment where I publish my things, either. :slight_smile:

This topic should make my information easier to find. Now that I’ve posted the list of the recipes, it will show up in forum search. Forum users looking for help with SCGI or WeeChat will see it.

You can of course publish where you want, but just be aware that it will be more difficult for people to find content that isn’t centralized and link to from our docs. I just ask that you keep the material up-to-date, as we get a lot of questions from people who find old articles that contain bad information.

(Unfortunately, we do not allow posting duplicate content on the wiki – it has to be original, and not published elsewhere.)

This is definitely a goal. I’ve dealt with those questions myself!

(Approximately 100% of them was due to Caddy 1 snippets marked simply “Caddy”. It makes me wonder how much it would help now if Caddy 1 had introduced a mandatory version directive. I plan to try it in my projects.)

This topic was automatically closed after 14 days. New replies are no longer allowed.