http-server icon indicating copy to clipboard operation
http-server copied to clipboard

Let's Encrypt HTTPS support

Open patrickdappollonio opened this issue 11 months ago • 1 comments

Several users have been able to successfully deploy http-server if they reverse-proxy it from Cloudflare and using a relaxed https-to-http connection between Cloudflare and the origin.

We should be able to support Let's Encrypt auto-certificates by leveraging Caddy's certmagic package.

At the core, it would be a matter of replacing the listener with:

err := certmagic.HTTPS([]string{"example.com", "www.example.com"}, mux)
if err != nil {
	return err
}

Which per the certmagic documentation, it will redirect http to https traffic.

patrickdappollonio avatar Jan 26 '25 05:01 patrickdappollonio

am using it with traefik and it works very good. just fyi.

aniel300 avatar Mar 25 '25 04:03 aniel300