
Show HN: Caddy, a cross-platform HTTP/2 web server - mholt
https://caddyserver.com
======
mholt
Hi HN. This was my hobby project over the last 4 months and it kept me sane
through my hardest semester. Feedback and contributions are totally welcome. I
know Caddy has a long way to go, but it's already replaced nginx and Apache
for my own needs. I figured it was time to make this a community-driven
project for all who are interested.

(Incidentally, I really hope my little Digital Ocean droplet can handle the
load. Wouldn't that be ironic? Anyway, if you have trouble, try the plain
HTTP/1.1 site or the GitHub project page:
[https://github.com/mholt/caddy](https://github.com/mholt/caddy))

~~~
jsd1982
Slightly off-topic: Try serverhub.com instead of digitalocean.com. They have
much more flexible offerings and much more storage available for cheaper
prices. I'm running a bunch of web sites off a single $18/mo plan VPS that
gives me 120GB of SSD storage.

~~~
czk
Are they OpenVZ?

~~~
serverhub
Yes, all of our VPS plans are OpenVZ.

~~~
sbuk
Any plans for European datacenters?

~~~
serverhub
sbuk,

We do not have any locations offshore yet, however we are looking to expand
and open new datacenters in the years to come.

------
buro9
It's worth noting:

[https://github.com/mholt/caddy/blob/master/server/server.go](https://github.com/mholt/caddy/blob/master/server/server.go)

That the actual web server in use is:

[https://github.com/bradfitz/http2](https://github.com/bradfitz/http2)

Which isn't to detract from the Caddy project which offers a tidy set of
configuration options so that the lib is more like an Nginx executable with
config files.

Perhaps the README can be updated though, as "Caddy binaries are available for
nearly every platform and has no dependencies" is a bit misleading. The binary
produced by Go may not have dependencies, but the Go code itself has a few
large dependencies.

~~~
jfolkins
bradfitz's http2 package will be rolled into Go's core upon completion so I
don't feel it is at all inappropriate for Matt to state "No Dependencies."

~~~
mmgutz
I also had the impression this was some new web server when Caddy seems to be
configuration glue of a WIP HTTP/2 server and external packages.

~~~
jfolkins
I see what you mean. That is a fair point.

------
slang800
I'm a little put-off by the baked-in Markdown compiler. It's partly concerning
because of the many dialects of Markdown, and the various configuration
options available for each one (which a server shouldn't need to support).

But also, in terms of Separation of Concerns, it doesn't seem like the server
should be responsible for compilation tasks when it doesn't need to be. It
would be much better to move that out into a separate tool for compiling
Markdown to HTML (perhaps on-save, for authoring) - many of those already
exist. Or, if you really wanted to perform compilation during a request, it
could at least be moved out of the server core, into a FastCGI script (perhaps
something like
[https://menteslibres.net/luminos/](https://menteslibres.net/luminos/)).

Oh, and that whole method of using a `Caddyfile` at the root of the project,
for configuration, is quite nice.

~~~
mholt
I actually agree with you. I wonder if the Markdown middleware will turn into
more of a "static site generator" anyway. There's definitely some room for
change in this area of its development, so if you'd like, I'd welcome your
involvement.

------
floatboth
Hi! I've been working on my own nginx replacement in Go that uses
bradfitz/http2:
[https://github.com/myfreeweb/443d](https://github.com/myfreeweb/443d)

It has random load balancing, glob patterns for hosts, SSH proxying (like
sslh) and, most importantly, proxying to UNIX sockets. And less code.

Maybe you could use my code to implement some of these features :-)

~~~
mholt
Thanks for sharing! I'll keep my eye on it. Will probably refer to it when I
add load balancing and unix socket support.

------
js4all
Great job, but I noticed that the server gets just a B rating (ssllabs) due
to:

    
    
        - rc4 acceptance
        - Session resumption (caching) No (IDs empty)
        - no OCSP stapling
        - Next Protocol Negotiation (NPN) Yes, but not signalling a http/1.1 fallback
    

I found no settings to change the TLS configuration. Is there any way to
change it?

~~~
mholt
Not yet, but that's coming. Wanted to start simple and add more controls as
needed. I'm cautious about changing any of the TLS stuff, especially with
Let's Encrypt coming up soon.

------
astrocat
As a designer who's been attempting to pick up some basic ops proficiency with
apache over the past month or so, this looks brilliantly simple. Thanks!

~~~
mholt
I'm glad! That's exactly what it was designed for (and to scratch my own
itches about configuring and maintaining other web servers).

------
ebbv
There's a problem with your "For Designers/For Bloggers" section of the page
rendering in Safari. The sections should be rendering side by side, I assume,
but are vertically stacked instead.

Also, if you want to convince me to switch to Caddy from Nginx, perhaps a page
with succinct explanation of its advantages would be helpful?

Lastly, this is just my opinion, but I don't want my web server to have a
Markdown interpreter in it. That's not a job for the web server. It's very
easy to put a very simple index file in front of Markdown to provide that
functionality.

~~~
mholt
Ah, Safari. #FlexboxProbs I'll try to fix that soon!

Thanks for the rest of your feedback. I agree that a list of advantages needs
to be more available. I'm looking forward to making that soon!

------
haneefmubarak
So when you say Caddy supports serving Markdown as HTML, is that normal,
boring Markdown only, or does it implement CommonMark (or something else
entirely)?

Also, do you have any plans to make Caddy support domain proxying (or whatever
it's called) where you can specify that requests for certain sites should be
proxied to a service running on another host + port combination (if it doesn't
support that already)?

Definitely a cool project though. I'll keep an eye on it. Keep up the
excellent work!

~~~
anonfunction
Not to detract from Caddy but we just released Kong[1] which is specifically
tailored to what you described.

1\. [https://github.com/Mashape/kong/](https://github.com/Mashape/kong/)

~~~
mholt
Kong looks amazing! The performance is impressive.

------
ccalvert
I like the support for markdown... I wonder if other web servers are thinking
of supporting or already support that feature? Does it recognize GitHub
Flavored Markdown (GFM)?

~~~
shurcooL
mholt said that Markdown support can be enhanced in a comment above
([https://news.ycombinator.com/item?id=9453216](https://news.ycombinator.com/item?id=9453216)).

There exists a native Go package to render GFM, see second from the top at
[https://github.com/avelino/awesome-go#text-
processing](https://github.com/avelino/awesome-go#text-processing).

~~~
Spiritus
Not to sound ungrateful. But would it be possible to split your GFM package
into its own repo? Because it's currently a PITA to vendor because it pulls
half the world with it?

~~~
shurcooL
Absolutely, that's a fair request.

Someone has already opened an issue about it at
[https://github.com/shurcooL/go/issues/19](https://github.com/shurcooL/go/issues/19),
and I'm planning to take care of it.

Edit: Oh, I guess that was you.

------
brianzelip
Really nice work on the documentation. As a front end designer who doesn't do
much server config, I'm finding it very easy get my head around it.

------
falcolas
There are a few directives I'm used to from Nginx which seem to be absent from
a quick perusal of the docs, but perhaps you can help?

Returning a non 200 or 300 redirect code.

Stripping headers

Deciding status on more than server name and path

Finally, there was discussion earlier on HN on how to write plugins which
communicate via sockets... Might be an interesting addition to consider adding
to your middleware API.

~~~
mholt
Not yet. But I would love to know your thoughts about how you'd like header
stripping to work, as well as more information about the others; feel free to
open an issue so I don't forget. :)

------
Zikes
Looking good! I really like the list of features in your roadmap, those will
be some big wins that will really set Caddy apart from other web server
software.

One recommendation I would make is the addition of some simple load balancing,
even round robin would be great.

~~~
mholt
Love the idea. One of my long-term goals is for Caddy to be able to connect
with other instances of Caddy, both for site deployment and load balancing.

------
ssutch3
Hey, I'm curious. How are you producing the build for all those platforms?

~~~
mholt
Gox. [https://github.com/mitchellh/gox](https://github.com/mitchellh/gox)

------
mitchi
You are probably aware of this. But on Windows and Chrome, when I try to open
a documentation page for "templates", it downloads a templates.gz file to my
computer. It does this for 90% of the documentation pages. Very annoying, I
have to cleanup a few files now :) Other than that the documentation is really
lacking. I wanted to spend time looking into the work you've done but I
haven't managed to do much besides having a static file server because of the
bad documentation. I starred the project on github, hopefully it will keep
getting better.

~~~
mholt
Oops. Will try to pinpoint that gz problem. What kind of things would you yet
like to see in the documentation?

------
Sir_Cmpwn
To what extent does this leverage the capabilities of HTTP/2? Can I do things
like give a higher priority to certain content?

~~~
mholt
For that, Caddy relies on this library:
[https://github.com/bradfitz/http2](https://github.com/bradfitz/http2) \- I
know that there is some dependency tree/prioritization work being done.

~~~
Sir_Cmpwn
Thanks for the info. Consider that you probably won't just be able to obtain
this feature from http2 for free - you probaby also want to make your
Caddyfiles support some smooth configs for setting these sorts of options.

~~~
mholt
For sure. I'll keep an eye on the progress of the library to see what will be
configurable.

------
bsimpson

        404 Not Found

~~~
castis
His site is being hugged to death ATM.
[https://github.com/mholt/caddy/](https://github.com/mholt/caddy/)

------
tallmankitch
Interesting project, starring it for the future. Especially like the custom
headers, gzip and simple config file. I'm curious are there similar projects
like this in Python/Ruby that are more mature? With auto-reload and more
production-ready documentation?

------
CatsoCatsoCatso
[https://caddyserver.com/blogging](https://caddyserver.com/blogging) Is giving
me a 404.

Edit: Following the link from the homepage works, but hitting F5 or loading it
without a referrer provides a 404. Weird.

------
tigeba
This looks like a cool project. Is it just me or has Caddy carried on the
grand web server tradition of using a config file format that is sort of like,
but not quite any other existing format.

------
pbowyer
Can the server serve HTTP/1 too? If not, does anyone know of a server that can
serve both HTTP/1 and HTTP/2?

~~~
mholt
Yep. A client must declare that it supports HTTP/2, otherwise the server will
fall back to HTTP/1.1. Also, any plaintext HTTP connection will not be HTTP/2
(major implementations of HTTP/2 don't support plaintext).

~~~
pbowyer
Thank you, I never realised that was how it worked!

------
milankragujevic
Excellent! I might start using it for some servers, however nginx is still the
go-to server for high traffic cdn servers.

------
jordic
Nice job gopher! I will try to deploy on some of my personal sites.

Is this the first http2 server released?

~~~
mmgutz
If I'm not mistaken it is Brad Fitz HTTP2' work from the Go team and will be
in the standard library in the future.

------
Keats
Text fonts (not the headers) are hard to read on chrome/firefox on archlinux.

Looks good otherwise!

------
Siecje
Anyone know how you can reverse proxy based on authenticated user?

With Caddy or another solution.

~~~
jamra
Sticky sessions usually work by IP address. They route requests from the same
IP address to the same server.

Nginx+ claims it does so (I didn't purchase it). HAProxy can be configured to
use sticky sessions.

~~~
Siecje
I would like to send each user to a different location, based on credentials.

------
mwexler
Apache v2 license, in case anyone was wondering

------
mihad
Awesome! I will try it for my personal website

------
alixaxel
Great work Matt!

------
dutchbrit
Any benchmarks available?

~~~
mholt
I recommend running your own based on your needs, but I did some very simple,
un-scientific benchmarks[1] anyway.

[1] [https://caddyserver.com/docs/faq](https://caddyserver.com/docs/faq)

------
jamra
Very nice!

------
influx6
Keep it rocking bro!

