Throw log
in your Caddyfile, run Caddy, make a request from your laptop, and then post the log line you get?
FYI, some quick testing:
➜ cat Caddyfile
http://:8080
log
@internal {
remote_ip 192.168.0.0/16
}
handle @internal {
respond "Internal!" 200
}
respond "External!" 403
~/Projects/test
➜ curl --ipv4 192.168.0.101:8080
Internal!⏎
~/Projects/test
➜ curl --ipv4 localhost:8080
External!⏎
And the corresponding log outputs:
2020/05/11 23:56:54.484 INFO http.log.access handled request {"request": {"method": "GET", "uri": "/", "proto": "HTTP/1.1", "remote_addr": "192.168.0.101:56345", "host": "192.168.0.101:8080", "headers": {"User-Agent": ["curl/7.64.1"], "Accept": ["*/*"]}}, "common_log": "192.168.0.101 - - [12/May/2020:09:56:54 +1000] \"GET / HTTP/1.1\" 200 9", "duration": 0.000013904, "size": 9, "status": 200, "resp_headers": {"Server": ["Caddy"], "Content-Type": []}}
2020/05/11 23:57:13.981 ERROR http.log.access handled request {"request": {"method": "GET", "uri": "/", "proto": "HTTP/1.1", "remote_addr": "127.0.0.1:56348", "host": "localhost:8080", "headers": {"User-Agent": ["curl/7.64.1"], "Accept": ["*/*"]}}, "common_log": "127.0.0.1 - - [12/May/2020:09:57:13 +1000] \"GET / HTTP/1.1\" 403 9", "duration": 0.000022953, "size": 9, "status": 403, "resp_headers": {"Server": ["Caddy"], "Content-Type": []}}
So at least I’m quite confident the syntax is correct, something else must be going on.