1. The problem I’m having:
Caddy won’t start… well, that’s the best I can describe it anyways. I’m a dummy at this, I don’t like to self depreciate but I’m so new to Caddy and deeper-computer stuff that I really have no idea what’s going on when I read through tutorials and whatnot. I lack that deeper understanding of how to configure and troubleshoot a service like this.
The short:
I’m trying to use Caddy to do a reverse proxy for some Minecraft server Dynmaps. I have 2 different domains, two different servers, 2 different dynmaps.
I had it working fine just a few days ago after adding the second server/Dynmap to the Caddyfile. “Working fine” means after much troubleshooting it just started working. I wish I could tell more info than that, I just kept restarting Caddy and eventually it worked. I restarted the computer, then tried to restart Caddy, and its no longer working. I’ve tried every combination of starting I can think of.
Caddy doesn’t start, it sort of starts but the reverse proxy doesn’t work. “localhost:2019” in the browser returns a 404 not found error. The console freezes. I have the domains and DNS configured through Cloudflare, and Cloudflare returns an “Error 523”.
2. Error messages and/or full log output:
There’s a couple I want to add here.
The first is the logs I get after first restarting the computer, and trying to run it the same way I did before when Caddy was fully working.
2024/01/07 23:03:56.196 INFO using provided configuration {"config_file": "/Users/2018macmini/Desktop/Caddyfile", "config_adapter": ""}
2024/01/07 23:03:56.196 WARN Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies {"adapter": "caddyfile", "file": "/Users/2018macmini/Desktop/Caddyfile", "line": 9}
2024/01/07 23:03:56.197 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["//localhost:2019", "//[::1]:2019", "//127.0.0.1:2019"]}
2024/01/07 23:03:56.197 INFO http.auto_https 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}
2024/01/07 23:03:56.197 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc00070ce80"}
2024/01/07 23:03:56.197 INFO http.auto_https enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2024/01/07 23:03:56.198 INFO tls.cache.maintenance stopped background certificate maintenance {"cache": "0xc00070ce80"}
Error: loading initial config: loading new config: loading http app module: provision http: loading trusted proxies modules: loading module 'static': provision http.ip_sources.static: parsing CIDR expression: '131.0.720.22/22': netip.ParsePrefix("131.0.720.22/22"): ParseAddr("131.0.720.22"): IPv4 field has value >255
The second is a few errors I get when I try to access “localhost:2019” in a browser
2024/01/07 23:09:33.942 INFO using adjacent Caddyfile
2024/01/07 23:09:33.943 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["//localhost:2019", "//[::1]:2019", "//127.0.0.1:2019"]}
2024/01/07 23:09:33.943 INFO autosaved config (load with --resume flag) {"file": "/Users/2018macmini/Library/Application Support/Caddy/autosave.json"}
2024/01/07 23:09:33.943 INFO serving initial configuration
2024/01/07 23:09:48.742 INFO admin.api received request {"method": "GET", "host": "localhost:2019", "uri": "/", "remote_ip": "127.0.0.1", "remote_port": "49472", "headers": {"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9"],"Connection":["keep-alive"],"Cookie":["JSESSIONID=node01op2g2uihxjs610cy2u8w8rum41.node0"],"Dnt":["1"],"Sec-Ch-Ua":["\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\""],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Ch-Ua-Platform":["\"macOS\""],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"]}}
2024/01/07 23:09:48.791 INFO admin.api received request {"method": "GET", "host": "localhost:2019", "uri": "/favicon.ico", "remote_ip": "127.0.0.1", "remote_port": "49472", "headers": {"Accept":["image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9"],"Connection":["keep-alive"],"Cookie":["JSESSIONID=node01op2g2uihxjs610cy2u8w8rum41.node0"],"Dnt":["1"],"Referer":["http://localhost:2019/"],"Sec-Ch-Ua":["\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\""],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Ch-Ua-Platform":["\"macOS\""],"Sec-Fetch-Dest":["image"],"Sec-Fetch-Mode":["no-cors"],"Sec-Fetch-Site":["same-origin"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"]}}
2024/01/07 23:09:51.182 INFO admin.api received request {"method": "GET", "host": "localhost:2019", "uri": "/", "remote_ip": "127.0.0.1", "remote_port": "49472", "headers": {"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9"],"Cache-Control":["max-age=0"],"Connection":["keep-alive"],"Cookie":["JSESSIONID=node01op2g2uihxjs610cy2u8w8rum41.node0"],"Dnt":["1"],"Sec-Ch-Ua":["\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\""],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Ch-Ua-Platform":["\"macOS\""],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"]}}
2024/01/07 23:09:52.094 INFO admin.api received request {"method": "GET", "host": "localhost:2019", "uri": "/", "remote_ip": "127.0.0.1", "remote_port": "49472", "headers": {"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9"],"Cache-Control":["max-age=0"],"Connection":["keep-alive"],"Cookie":["JSESSIONID=node01op2g2uihxjs610cy2u8w8rum41.node0"],"Dnt":["1"],"Sec-Ch-Ua":["\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\""],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Ch-Ua-Platform":["\"macOS\""],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"]}}
2024/01/07 23:09:52.674 INFO admin.api received request {"method": "GET", "host": "localhost:2019", "uri": "/", "remote_ip": "127.0.0.1", "remote_port": "49472", "headers": {"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9"],"Cache-Control":["max-age=0"],"Connection":["keep-alive"],"Cookie":["JSESSIONID=node01op2g2uihxjs610cy2u8w8rum41.node0"],"Dnt":["1"],"Sec-Ch-Ua":["\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\""],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Ch-Ua-Platform":["\"macOS\""],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"]}}
3. Caddy version:
Version 2.7.6
4. How I installed and ran Caddy:
I installed Caddy using Homebrew for macOS. I let Caddy install and run through that, then use the native commands (caddy ----- versus brew services caddy —). In the comments it says to add domain info and such, the two domains I’m trying to work with are harkenburgmc.net and averytallproblem.com, with their respective Minecraft Dynmap addresses being map.harkenburgmc.net and dynmap.averytallproblem.com . Those are the two subdomains I’m reverse proxying on my machine. Or was anyways, before something happened.
a. System environment:
2018 Mac mini, x86, OS is MacOS Sonoma 14.2.1
b. Command:
The Caddyfile I use is on my desktop, I wasn’t able to find the right directory so I just started using this method. It worked before, and now after restarting the computer it doesn’t.
caddy run --config ~/Desktop/Caddyfile
c. Service/unit/compose file:
n/a
d. My complete Caddy config:
Below is exactly what worked before it stopped working.
map.harkenburgmc.net
reverse_proxy localhost:5316
}
dynmap.averytallproblem.com
reverse_proxy localhost:5315
}
I’ve also been told to add the below “global options block” to make sure Cloudflare can be let through. However, I’ve been unable to confirm if this works or not.
# Global Options Block
{
servers {
trusted_proxies static private_ranges 173.245.48.0/20 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 141.101.64.0/18 108.162.192.0/18 190.93.240.0/20 188.114.96.0/20 197.234.240.0/22 198.41.128.0/17 162.158.0.0/15 104.16.0.0/13 104.24.0.0/14 172.64.0.0/13 131.0.720.22/22
}
}
map.harkenburgmc.net
reverse_proxy localhost:5316
}
dynmap.averytallproblem.com
reverse_proxy localhost:5315
}
5. Links to relevant resources:
i’m not sure, I’m sure I’ll have some. I’m really going into this blind so feel free to tear this apart. There’s no such thing as too obvious, I’m really so new to this haha. Except DNS, I did configure that. Everything was working before, as explained above. Something goofed when I restarted the computer (nothing was changed that I know of) and now I can’t restart it.
Thanks so much for your time.