Unrecognized directive: tsl

1. The problem I’m having:

New to caddy and trying to figure out how it works, apologizes in advance for mistakes.

I’m trying to use caddy on a network not connected to the internet.

My eventual goal is simply to create a proxy: forward (back and forth) all traffic reaching one machine to another machine which is not connected to any network other than via the previous machine. This should happen depending on name: name1.example.com should go to the other machine, name2.example.com should stay local. Hopefully, do that for any port automatically (if not possible, I guess I can specify each port as a separate entry).

To start learning I’m just following the tutorial (so serving dummy sites for now). and so Caddy is not working because it wants to use Let’s Encrypt. Following guidance on

I added tsl things (either off or internal) and it doesn’t work

2. Error messages and/or full log output:

systemd[1]: Starting Caddy web server...
caddy[2585975]: {"level":"info","ts":1763749364.7759857,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
caddy[2585975]: Error: adapting config using caddyfile: /etc/caddy/Caddyfile.d/example.caddyfile:7: unrecognized directive: tsl
systemd[1]: caddy.service: Control process exited, code=exited, status=1/FAILURE
systemd[1]: caddy.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Caddy web server.

3. Caddy version:

v2.6.4

4. How I installed and ran Caddy:

a. System environment:

RH 9.6

b. Command:

dnf install caddy
systemct start caddy

d. My complete Caddy config:

http://localhost {
        respond "Hello world"
}

https://localhost {
#       tsl internal
        tsl off
        respond "Hello https world"
}

5. Links to relevant resources:

Welcome to the Caddy club :slight_smile:

Just a couple of notes:

  1. That’s a very old document you’re referencing.
  2. There’s a small typo in your config. It should be tls, not tsl.

HTTP only:

{
    auto_https off
}

http://localhost {
    respond "Hello HTTP world"
}

HTTPS with HTTP-to-HTTPS redirect and internal certificate

localhost {
    tls internal
    respond "Hello HTTPS world"
}

Separate HTTP and HTTPS with internal certificate:

{
    auto_https disable_redirects
}

http://localhost {
    respond "Hello HTTP world"
}

https://localhost {
    tls internal
    respond "Hello HTTPS world"
}
1 Like

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