Previously written caddyfile does not work

1. Output of caddy version:

2.5.2

2. How I run Caddy:

a. System environment:

Windows 10 Enterprise

b. Command:

caddy adapt --config caddy\Caddyfile.client

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane. -->

d. My complete Caddy config:

0.0.0.0:8446 {
        log stdout
        errors stderr
        tls self_signed
        proxy / http://localhost:3100 {
                transparent
                websocket
                keepalive 10
                header_downstream Content-Security-Policy "default-src 'self'; style-src 'self' 'unsafe-inline'; object-src 'none'; img-src 'self' data:;"
        }
        proxy /devel-login-kips https://maasikas.dev.icefire {
                keepalive 10
        }
        proxy /kks-api http://localhost:9021 {
                transparent
                keepalive 10
        }
        proxy /filetransfer http://klaabu.mta:12220 {
                transparent
        }
        rewrite {
                if {path} has configuration
                if {path} not_has kks-api
                to /config.client.dev.json
        }
}

3. The problem I’m having:

I need to develop new functionality for a project I have never done anything for. For local development the Readme told that I need to use Caddy for HTTPS proxying. I have installed caddy, but when I try to load the config then it gives me an error (see below). I can only assume that back in 2018 the syntax for caddyfile was different. Can someone please verify if that is the case and if so then what version of caddy should I install and what would be the simplest method of installing it?

As a sidenote then my project’s readme had the following steps for running Caddy (it did not work). So I adjusted the syntax for loading config as written above. The readme had the following steps:

Add HTTPS proxy using Caddy server and start local webpack-dev-server

($PROJECT_HOME is corresponding project home directory)

  1. Download Caddy
  2. Unpack to $CADDY_HOME (C:/caddy or other applicable directory)
  3. Run from terminal window / cmd:

$CADDY_HOME\caddy --conf caddy\Caddyfile.client.dev

4. Error messages and/or full log output:

adapt: parsing caddyfile tokens for 'log': caddy\Caddyfile.client:2 - Error during parsing: Wrong argument count or unexpected line ending after 'stdout'

5. What I already tried:

As written above then I tried loading the config with syntax that works, but it doesn’t load the file…

6. Links to relevant resources:

That’s a Caddy v1 config. Caddy v2 was a complete rewrite, so v1 configs are not compatible.

Please see the upgrade guide:

2 Likes

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