Yes, you can use the remote_ip matcher to make routing decisions. See Request matchers (Caddyfile) — Caddy Documentation
remote_ip