Caddy on windows (catch all - proxy)

Hi Everyone,

We’re trying to make Caddy work on Windows 2012 server.
It should only act as a catch-all proxy and pass all the http/s traffic to a different server.
It works properly on CentOS but we’re not succeeding to make it work on Windows.

There might be a problem because the “.caddy” folder can’t be created on windows, as windows doesn’t allow folders that start with a dot (.), so SSL certificates can’t be stored anywhere.

Has anyone succeeded to setup a catch-all windows configuration?

Caddy file:

*
proxy / **.**.**.**:80 {
    transparent
}
tls {
    max_certs 1200
    #ca https://acme-staging.api.letsencrypt.org/directory
    ca https://acme-v01.api.letsencrypt.org/directory
}
root c:\caddy
log c:\caddylogs\access.log
errors c:\caddylogs\error.log

Error message:

2018/04/29 08:33:59 http: TLS handshake error from **.**.**.**:50911: directory missing new registration URL

Thank you!

Hey Arik,

The first thing I notice is that the label for your site: *, matches only a single domain label, like localhost, not any publicly-valid domain name. You’ll want to specify just the port or scheme to do a catch-all, like https:// or :443.

Caddy no longer supports the ACME 1.0 endpoint, so remove the ca lines from your tls directive. But be sure to test with the staging endpoint! Or you risk getting rate limited. :slight_smile: Staging Environment - Let's Encrypt

Really? That’s the first I’ve heard of it, if so, which seems unlikely after ~3 years of it running fine on Windows, reportedly.

You can set the %CADDYPATH% environment variable to something else, a folder that doesn’t have a dot. Remember to test with the staging endpoint.

Here is more info about the CADDYPATH env variable: https://caddyserver.com/docs/cli#caddypath

2 Likes

Matt, I love you!
Thank you so much. It works perfectly.
Go Caddy :slight_smile:

2 Likes

Glad you got it working!

I would like to learn more about dot files in Windows… I will look into it.

Windows allows files with dots at the beginning just fine when the file/folder is being created programatically. Of course @caddywindows could have come across a problem with the .caddy folder, but I would say it’s much more likely to be related to something else, like permissions maybe?

The real problem is in manual creation of files/folders that start with a dot. Windows won’t let you manually create a .caddy folder. You can get around it though by naming the file/folder .caddy. and Windows will allow it and remove the trailing . for you…

Either way, dot files are fine on Windows, they’re just awkward to manually create.

1 Like

Thanks Lucas,
It’s clear now. We were using the old acme API version so the certificates were not created.
Once we changed the acme API version I could see the Caddy creates the .caddy folder properly. There’s no issue with that.
You can delete this post if you think it might confuse future Windows users.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.