sreyansjain

sreyansjain

Caddy is fantastic little production ready server that we can use instead of Apache or Nginx reverse proxy in front of multiple phoenix applications in one box.

The best thing is that we get https without needing to do anything on phoenix side. Caddy automatically provisions a certificate from Let’s encrypt.

All we need to do is just write one line of code.

Some important commands

sudo caddy start
sudo caddy stop
sudo caddy reload

Concept

We need to have a file Caddyfile (no extension) in the directory from where we would start the caddy server.

Say we have Caddyfile in the home directory - /home/sher

This is the content of the Caddyfile -

use.example.app {
        reverse_proxy * http://localhost:6001
}

test.example.app {
        reverse_proxy * http://localhost:8066
}
example.app {
        reverse_proxy * http://localhost:8000
}
another-site.com {
        reverse_proxy * http://localhost:4002
}

So we just need to write one line for each domain and our job is done.
Please note

test.example.app {
        reverse_proxy * http://localhost:8066
}

Here the phoenix app is still running in localhost but the final url would be https://test.example.app. This happens by magic. So you don’t need to do anything and https should automatically work.

This automatically gives you HTTP/2 which is faster than HTTP/1.1.

My Use case

I run a software development agency and we have several projects running in one box, so Caddy really helps there.

More advanced stuff is also possible. Check out the docs.

I found Caddy really interesting and thought that I should share it with the community.

P.S: I am not associated with Caddy in any way

Showing Posts 1 to 4

Exadra37

Exadra37

You also have the library site_encrypt from @sasajuric.

I am using Traefik for the same propose because I deploy with Docker.

If not in mistake Traefik uses Caddy under the hood.

rasputin303

rasputin303

I’m using Caddy as a reverse proxy for Phoenix too! I spent a weekend trying and failing to understand Nginx configs, Docker and so on, and eventually gave up. Then I found Caddy and all the SSL/LetsEncrypt stuff just works out of the box.

Kurisu

Kurisu

I’m also running a couple of umbrella phoenix apps in production with caddy-2 as reverse proxy. I really appreciate the simplicity of its configuration. I had a bit hard time figuring how to install it on ubuntu server, but I eventually find some good tutorials that helped me.

carterbryden

carterbryden

I love Caddy!

I’ve been building a small SAAS app with Elixir & Phoenix that makes heavy use of Caddy V2 and it’s been amazing to use. The app is an API for other apps that want to let their users connect custom domains or spin up subdomains on the fly. Each of my users gets their own dedicated Caddy instances that my app manages, and it’s worked flawlessly.

I’d really recommend checking out the JSON API as well as an alternative to using a Caddyfile. V2 has an admin API you can use to make updates while it’s running. Can’t recommend it enough.

Caddy is also built mostly by one person, Matt Holt, who can always use new sponsors on GitHub, if it’s working well for you :+1:. Great project to support.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews