Upgrading Caddyfile to V2

1. Caddy version (caddy version):


2. How I run Caddy:

caddy run

a. System environment:

Windows 2019 data center on Azure

b. Command:

caddy run

c. Service/unit/compose file:

Windows VM

d. My complete Caddyfile or JSON config:

reverse_proxy / 
tls {
    ca https://acme-v02.api.letsencrypt.org/directory
root C:\caddy\www
#log C:\caddy\logs\caddy.log
#errors C:\caddy\logs\error.log

3. The problem I’m having:

  1. I’m trying to write this Caddyfile (V1) in V2 format.
    I don’t see certificates being created.

Here’s the old (V1) Caddyfile:

proxy / {
tls {
ca https://acme-v02.api.letsencrypt.org/directory
ask http://cp.[deleted-domain].com/callbacks/caddy/ValidateCustomURL.aspx
root C:\caddy\www
#log C:\caddy\logs\caddy.log
#errors C:\caddy\logs\error.log

4. Error messages and/or full log output:

This is the console output:

c:\caddy>caddy run
2021/05/24 17:24:43.940 e[34mINFOe[0m using adjacent Caddyfile
2021/05/24 17:24:43.942 e[33mWARNe[0m input is not formatted with ‘caddy fmt’ {“adapter”: “caddyfile”, “file”: “Caddyfile”, “line”: 2}
2021/05/24 17:24:43.947 e[34mINFOe[0m admin admin endpoint started {“address”: “tcp/localhost:2019”, “enforce_origin”: false, “origins”: [“localhost:2019”, “[::1]:2019”, “”]}
2021/05/24 17:24:43.947 e[34mINFOe[0m http server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {“server_name”: “srv0”, “https_port”: 443}
2021/05/24 17:24:43.949 e[34mINFOe[0m http enabling automatic HTTP->HTTPS redirects {“server_name”: “srv0”}
2021/05/24 17:24:43.949 e[34mINFOe[0m tls.cache.maintenance started background certificate maintenance {“cache”: “0xc000258700”}
2021/05/24 17:24:43.951 e[34mINFOe[0m tls cleaning storage unit {“description”: “FileStorage:C:\Users\arik-caddy\AppData\Roaming\Caddy”}
2021/05/24 17:24:43.951 e[34mINFOe[0m tls finished cleaning storage units
2021/05/24 17:24:43.956 e[34mINFOe[0m autosaved config (load with --resume flag) {“file”: “C:\Users\arik-caddy\AppData\Roaming\Caddy\autosave.json”}
2021/05/24 17:24:43.956 e[34mINFOe[0m serving initial configuration
2021/05/24 17:31:53.066 e[34mINFOe[0m shutting down {“signal”: “SIGINT”}
2021/05/24 17:31:53.066 e[33mWARNe[0m exiting; byeee!! :wave: {“signal”: “SIGINT”}
2021/05/24 17:31:53.099 e[34mINFOe[0m tls.cache.maintenance stopped background certificate maintenance {“cache”: “0xc000258700”}
2021/05/24 17:31:53.115 e[34mINFOe[0m admin stopped previous server {“address”: “tcp/localhost:2019”}
2021/05/24 17:31:53.115 e[34mINFOe[0m shutdown complete {“signal”: “SIGINT”, “exit_code”: 0}

5. What I already tried:

6. Links to relevant resources:

Hey Arik,

Have you taken a look at our upgrade guide?

It should tell you most of what you need to know. Pay special attention to request matchers: / is an exact path match, not a prefix match, so remove that in your v2 config.

Be sure to enable on-demand TLS like your v1 config did. Here is a section about that with useful links: Automatic HTTPS — Caddy Documentation

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.