Live data from Hacker News

Show HN: Caddy v2.5.0

github.com

21–30 of 115 posts

Re: Show HN: Caddy v2.5.0

#21
post #7

Earlier quoted context omitted.

Sounds like it would allow automatic handling of either failed backend nodes or adding new capacity over time without restarting the proxy, but I could be reading it wrong.

Basically this, yeah. You can add or take down backends without having to keep web server config in sync and reload it. (Though config reloads are pretty light anyways.)

Does it have implications for long-lived connections like SSE and websockets? It seems like restarts would have been disruptive to those but now might not be?

Re: Show HN: Caddy v2.5.0

#22

Is Caddy scriptable? I don't know much about it. But ever since I discovered nginx-lua-module and OpenResty it's been pretty much a game-changer for me. Curious if other popular webservers have done similar? Not really talking about things like mod_perl/php. Although I guess those are somewhat the same thing.

Kind of (indirectly); we don't have an interpreter built-in, but the JSON config is managed natively through an API: https://caddyserver.com/docs/api

So yeah, you can write scripts that control Caddy while it's online.

The nice thing about the API is you can code in whatever environment or language you prefer: no need to learn Caddy's scripting language or anything like that. (The config is JSON, so nearly every language can output it.)

Re: Show HN: Caddy v2.5.0

#23

I've been using this Docker image in a Docker Compose configuration to run some apps on a VPS https://github.com/lucaslorentz/caddy-docker-proxy Pretty nice, handles routing to your containers and manages LetsEncrypt for you. Response times are super fast too (<= 100ms for an ASP Web API application which uses Postgres via Entity Framework).

Best kept secret of Caddy+Docker.

Re: Show HN: Caddy v2.5.0

#24

Is Caddy scriptable? I don't know much about it. But ever since I discovered nginx-lua-module and OpenResty it's been pretty much a game-changer for me. Curious if other popular webservers have done similar? Not really talking about things like mod_perl/php. Although I guess those are somewhat the same thing.

Apache has built-in lua scripting support nowadays.

Re: Show HN: Caddy v2.5.0

#25
post #21
post #7

Earlier quoted context omitted.

Basically this, yeah. You can add or take down backends without having to keep web server config in sync and reload it. (Though config reloads are pretty light anyways.)

Does it have implications for long-lived connections like SSE and websockets? It seems like restarts would have been disruptive to those but now might not be?

Possibly; the long-lived connections eventually have to end when reloads (note: restarts and reloads are different) happen, to free up resources -- otherwise they leak. (The grace period is configurable and can even be disabled.)

Re: Show HN: Caddy v2.5.0

#26
post #18

Caddy is such a delight! I can't reccomend it fast enough when somebody mentions they are on nginx. Small random feedback: I like the idea of JSON configuration but most of the common docs/recipes are documented only with the Caddyfile format. I couldn't figure out the full JSON schema that was expected so I wound up generating a Caddyfile string instead for my programatic control. Maybe there is some translation too…

It seems that this command will translate the Caddyfile to json.

./caddy adapt

Re: Show HN: Caddy v2.5.0

#27

Where does Caddy live in a Kubernetes world -- or does it? (I'm not the most knowledgeable with either, so genuinely curious how these pieces all fit together).

In addition to what others have said, I think it’s a handy option for a lightweight http backend or proxy when you need it to glue something together. For example, quickly fronting an s3 bucket, or serving static content generated by another container in the same pod, etc.

Re: Show HN: Caddy v2.5.0

#28
post #18

Caddy is such a delight! I can't reccomend it fast enough when somebody mentions they are on nginx. Small random feedback: I like the idea of JSON configuration but most of the common docs/recipes are documented only with the Caddyfile format. I couldn't figure out the full JSON schema that was expected so I wound up generating a Caddyfile string instead for my programatic control. Maybe there is some translation too…

Thanks for recommending it!

I hear ya. The JSON config is definitely not trivial. I wrote our JSON docs and strove to made them easy to follow. You can traverse into the module structure piece-by-piece here: https://caddyserver.com/docs/json/

There is also a Caddy plugin by @abiosoft that can generate a JSON schema for your custom Caddy builds, which can then be used by IDEs to give you autocomplete and validation: https://github.com/abiosoft/caddy-json-schema

I also sometimes recommend writing your config by hand in the Caddyfile, then using `caddy adapt` to get the JSON equivalent. (It might not always be the prettiest JSON, since the adapter is only so smart.) But then you can fine-tune the JSON a little easier, possibly. Hope that helps!

Re: Show HN: Caddy v2.5.0

#30
I utterly adore your project. Thank you so much.

Are there plans for SMTP or IMAP proxying?

Do you do SNI proxying too?

I would love for Caddy to be my one stop shop for all TLS termination.

Post reply on HN