1. Caddy version (caddy version
):
2. How I run Caddy:
a. System environment:
Ubuntu
b. Command:
I run Caddy through systemctl as installed from “sudo apt install caddy”
sudo systemctl start caddy
c. Service/unit/compose file:
paste full file contents here
d. My complete Caddyfile or JSON config:
#this section works without a problem and is the reverse proxy for a Jellyfin installation
myDomain.com {
reverse_proxy 127.0.0.1:8096
}
#This is where we have a problem
#I've specified port 4433 in the Settings.cfg file for PlexConnect
#
trailers.apple.com:80, trailers.apple.com:443 {
reverse_proxy http://127.0.0.1:4433
tls /home/alex/PlexConnect-master/assets/certificates/trailers.pem /home/alex/PlexConnect-master/assets/certificates/trailers.key
}
3. The problem I’m having:
In addition to running a reverse proxy for my domain, which works without a problem I’m also trying to run PlexConnect on the same machine. PlexConnect functions as a DNS for older spec AppleTV units to redirect their requests on put Plex on them when they don’t natively run 3rd party apps.
Because the AppleTV will always us port 80 or 443 I need to add an entry to my Caddyfile to allow PlexConnect to run on my machine without conflicting with my Jellyfin reverse proxy.
4. Error messages and/or full log output:
● caddy.service - Caddy
Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-08-24 18:27:58 MDT; 6s ago
Docs: https://caddyserver.com/docs/
Process: 31918 ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)
Process: 31954 ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)
Main PID: 31954 (code=exited, status=1/FAILURE)
Aug 24 18:27:58 myComputer caddy[31954]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Aug 24 18:27:58 myComputer caddy[31954]: HOME=/var/lib/caddy
Aug 24 18:27:58 myComputer caddy[31954]: LOGNAME=caddy
Aug 24 18:27:58 myComputer caddy[31954]: USER=caddy
Aug 24 18:27:58 myComputer caddy[31954]: INVOCATION_ID=34015d9dae9149a18c1a631447d8e7e2
Aug 24 18:27:58 myComputer caddy[31954]: JOURNAL_STREAM=9:275227
Aug 24 18:27:58 myComputer caddy[31954]: {"level":"info","ts":1598315278.0026765,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Aug 24 18:27:58 myComputer caddy[31954]: run: adapting config using caddyfile: server listening on [:80] is HTTP, but attempts to configure TLS connection policies
Aug 24 18:27:58 myComputer systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Aug 24 18:27:58 myComputer systemd[1]: caddy.service: Failed with result 'exit-code'.
If I remove the entry for port 80 I get the following
● caddy.service - Caddy
Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-08-24 18:29:55 MDT; 4s ago
Docs: https://caddyserver.com/docs/
Process: 31918 ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)
Process: 32087 ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)
Main PID: 32087 (code=exited, status=1/FAILURE)
Aug 24 18:29:55 myComputer caddy[32087]: USER=caddy
Aug 24 18:29:55 myComputer caddy[32087]: INVOCATION_ID=56fcc1dded8a477c8b233c7e5e612ae6
Aug 24 18:29:55 myComputer caddy[32087]: JOURNAL_STREAM=9:276496
Aug 24 18:29:55 myComputer caddy[32087]: {"level":"info","ts":1598315395.2542715,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Aug 24 18:29:55 myComputer caddy[32087]: {"level":"info","ts":1598315395.255799,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins"
Aug 24 18:29:55 myComputer caddy[32087]: 2020/08/24 18:29:55 [INFO][cache:0xc000181bc0] Started certificate maintenance routine
Aug 24 18:29:55 myComputer caddy[32087]: 2020/08/24 18:29:55 [INFO][cache:0xc000181bc0] Stopped certificate maintenance routine
Aug 24 18:29:55 myComputer caddy[32087]: run: loading initial config: loading new config: loading http app module: provision http: getting tls app: loading tls app module: provision tls: load
Aug 24 18:29:55 myComputer systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Aug 24 18:29:55 myComputer systemd[1]: caddy.service: Failed with result 'exit-code'.
5. What I already tried:
I’ve done my best to try to adapt the suggestion on Github, linked below, from a Caddy to Caddy2 Caddyfile. Unlike the comment I’ve changed both the HTTP and HTTPS ports because I’ve left SSL enabled. I’ve also updated the syntax, as shown in my CaddyFile, to what I think is a more correct Caddy2 CaddyFile.
I also tried to separate the secure ports for trailers.apple.com:80 and trailers.apple.com:443 into separate reverse proxy entries in the CaddyFile but without any luck.
6. Links to relevant resources:
https://github.com/iBaa/PlexConnect/issues/441#issuecomment-302879866