This request is triggering a redirect from port 80 to port 443, because Caddy is HTTPS by default.
If you try curl -v https://192.168.102.216 you might get further. But you might get TLS errors because Caddy won’t be able to issue a TLS certificate for an IP address hostname as per Automatic HTTPS — Caddy Documentation so you’d need to add tls internal to your config for that to work… plus you’d need to install the internal CA’s root certificate to any devices you might make requests from.
Similarly here, you didn’t specify https://, so curl tried an HTTP request, but that server is listening for HTTPS requests.
If you’re fine with just HTTP in your local network, you can prefix your site address with http://. No problems if you trust the devices on your network.
(One minor correction: Caddy will still issue self-signed TLS certificates in this case. Caddy uses HTTPS for everything except port 80 or explicit HTTP or when TLS is explicitly disabled.)
When I test curl with https:// it looks like this.
C:\Users\Me>curl -v https://192.168.102.216
* Trying 192.168.102.216:443...
* Connected to 192.168.102.216 (192.168.102.216) port 443 (#0)
* schannel: disabled automatic use of client certificate
* schannel: using IP address, SNI is not supported by OS.
* ALPN: offers http/1.1
* schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
* Closing connection 0
curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
C:\Users\Me>curl -v https://192.168.102.216:2020
* Trying 192.168.102.216:2020...
* Connected to 192.168.102.216 (192.168.102.216) port 2020 (#0)
* schannel: disabled automatic use of client certificate
* schannel: using IP address, SNI is not supported by OS.
* ALPN: offers http/1.1
* schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
* Closing connection 0
curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
But I dont get it, I dont see “hello” or “hello 2” when I curl but when I test “localhost” and “https://192.168.102.216” in the webbrowser I get “hello” or “hello 2” that part works at least there.
I tried to add “tls internal” but it did not make any difference.
First time caddy started it asked to add cert “Caddy Local Authority - ECC Intermediate”. Edge use windows CA store but Firefox use its own. So edge I get “hello” but in Firefox I first get a warning.
SEC_ERROR_UNKNOWN_ISSUER
But when I proced and click on the button “accept the risk” I get “hello” in firefox to and I can see the cert is:
Common Name: Caddy Local Authority - ECC Intermediate
DNS Name: localhost
No, they are different! localhost is a hostname, and 198.168.102.216 is an IP address (that’s not even on the loopback interface). The difference matters when it comes to TLS (that’s not a Caddy thing).
Caddy isn’t able to install itself into every root store (yet) – we use a dependency that I hope will eventually be able to support more stores.