Need help trying to block / filter incoming connections

1. The problem I’m having:

Trying to setup geo filtering and block certain requests, but can’t seem to get it to work.

2. Error messages and/or full log output:

2024/06/18 03: 45: 27.893 INFO http enabling automatic TLS certificate management {
    "domains": [
        "beacons.minastirith.net",
    ]
}
2024/06/18 03: 46: 07.765 INFO admin.api received request {
    "method": "GET",
    "host": "localhost:2019",
    "uri": "/",
    "remote_ip": "127.0.0.1",
    "remote_port": "56307",
    "headers": {
        "Accept": [
            "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8"
        ],
        "Accept-Encoding": [
            "gzip, deflate, br, zstd"
        ],
        "Accept-Language": [
            "en-US,en;q=0.5"
        ],
        "Connection": [
            "keep-alive"
        ],
        "Priority": [
            "u=1"
        ],
        "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 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0"
        ]
    }
}
2024/06/18 03: 46: 07.844 INFO admin.api received request {
    "method": "GET",
    "host": "localhost:2019",
    "uri": "/favicon.ico",
    "remote_ip": "127.0.0.1",
    "remote_port": "56307",
    "headers": {
        "Accept": [
            "image/avif,image/webp,/"
        ],
        "Accept-Encoding": [
            "gzip, deflate, br, zstd"
        ],
        "Accept-Language": [
            "en-US,en;q=0.5"
        ],
        "Connection": [
            "keep-alive"
        ],
        "Priority": [
            "u=6"
        ],
        "Referer": [
            "http://localhost:2019/"
        ],
        "Sec-Fetch-Dest": [
            "image"
        ],
        "Sec-Fetch-Mode": [
            "no-cors"
        ],
        "Sec-Fetch-Site": [
            "same-origin"
        ],
        "User-Agent": [
            "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0"
        ]
    }
}
2024/06/18 03: 58: 25.026 INFO http.log.access handled request {
    "request": {
        "remote_ip": "152.203.6.118",
        "remote_port": "49269",
        "client_ip": "152.203.6.118",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
            ],
            "Content-Length": [
                "0"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 03: 59: 27.940 INFO http.log.access handled request {
    "request": {
        "remote_ip": "35.216.227.155",
        "remote_port": "53722",
        "client_ip": "35.216.227.155",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 04: 38: 37.927 INFO http.log.access handled request {
    "request": {
        "remote_ip": "31.220.1.83",
        "remote_port": "34994",
        "client_ip": "31.220.1.83",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/",
        "headers": {
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ],
            "User-Agent": [
                "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 05: 14: 17.262 INFO http.log.access handled request {
    "request": {
        "remote_ip": "185.191.126.213",
        "remote_port": "47070",
        "client_ip": "185.191.126.213",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/",
        "headers": {}
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ]
    }
}
2024/06/18 06: 09: 04.908 INFO http.log.access handled request {
    "request": {
        "remote_ip": "185.224.128.43",
        "remote_port": "50622",
        "client_ip": "185.224.128.43",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/",
        "headers": {
            "Accept": [
                "/"
            ],
            "Connection": [
                "keep-alive"
            ],
            "Accept-Encoding": [
                "gzip, deflate",
                "gzip, deflate"
            ],
            "X-Requested-With": [
                "XMLHttpRequest"
            ],
            "Content-Type": [
                "application/x-www-form-urlencoded; charset=UTF-8"
            ],
            "Accept-Language": [
                "en US,en;q=0.9,sv;q=0.8"
            ],
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0.0002924,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 06: 15: 01.811 INFO http.log.access handled request {
    "request": {
        "remote_ip": "141.98.11.79",
        "remote_port": "56416",
        "client_ip": "141.98.11.79",
        "proto": "HTTP/1.1",
        "method": "CONNECT",
        "host": "google.com:443",
        "uri": "google.com:443",
        "headers": {
            "User-Agent": [
                "Go-http-client/1.1"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Location": [
            "https://google.com/"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ]
    }
}
2024/06/18 06: 17: 09.346 INFO http.log.access handled request {
    "request": {
        "remote_ip": "45.148.10.174",
        "remote_port": "44696",
        "client_ip": "45.148.10.174",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/cgi-bin/luci/;stok=/locale?form=country&operation=write&country=$(id%3E%60for+proc_dir+in+%2Fproc%2F%5B0-9%5D%2A%3B+do+pid%3D%24%7Bproc_dir%23%23%2A%2F%7D%3B+buffer%3D%24%28cat+%22%2Fproc%2F%24pid%2Fmaps%22%29%3B+if+%5B+%22%24%7B%23buffer%7D%22+-gt+1+%5D%3B+then+if+%5B+%22%24%7Bbuffer%23%2A%22%2Flib%2F%22%7D%22+%3D+%22%24buffer%22+%5D+%26%26+%5B+%22%24%7Bbuffer%23%2A%22telnetdbot%22%7D%22+%3D+%22%24buffer%22+%5D%3B+then+kill+-9+%22%24pid%22%3B+fi%3B+fi%3B+done%60)",
        "headers": {
            "User-Agent": [
                "Go-http-client/1.1"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Location": [
            "https://{MY_IP_ADDR}/cgi-bin/luci/;stok=/locale?form=country&operation=write&country=$(id%3E%60for+proc_dir+in+%2Fproc%2F%5B0-9%5D%2A%3B+do+pid%3D%24%7Bproc_dir%23%23%2A%2F%7D%3B+buffer%3D%24%28cat+%22%2Fproc%2F%24pid%2Fmaps%22%29%3B+if+%5B+%22%24%7B%23buffer%7D%22+-gt+1+%5D%3B+then+if+%5B+%22%24%7Bbuffer%23%2A%22%2Flib%2F%22%7D%22+%3D+%22%24buffer%22+%5D+%26%26+%5B+%22%24%7Bbuffer%23%2A%22telnetdbot%22%7D%22+%3D+%22%24buffer%22+%5D%3B+then+kill+-9+%22%24pid%22%3B+fi%3B+fi%3B+done%60)"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ]
    }
}
2024/06/18 06: 26: 14.184 INFO http.log.access handled request {
    "request": {
        "remote_ip": "45.93.250.43",
        "remote_port": "53660",
        "client_ip": "45.93.250.43",
        "proto": "HTTP/1.1",
        "method": "CONNECT",
        "host": "109.71.254.64:1337",
        "uri": "109.71.254.64:1337",
        "headers": {}
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://109.71.254.64/"
        ],
        "Content-Type": []
    }
}
2024/06/18 06: 26: 15.247 INFO http.log.access handled request {
    "request": {
        "remote_ip": "45.93.250.43",
        "remote_port": "53670",
        "client_ip": "45.93.250.43",
        "proto": "HTTP/1.1",
        "method": "CONNECT",
        "host": "109.71.254.64:1337",
        "uri": "109.71.254.64:1337",
        "headers": {}
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://109.71.254.64/"
        ],
        "Content-Type": []
    }
}
2024/06/18 06: 26: 15.945 INFO http.log.access handled request {
    "request": {
        "remote_ip": "45.93.250.43",
        "remote_port": "45178",
        "client_ip": "45.93.250.43",
        "proto": "HTTP/1.1",
        "method": "CONNECT",
        "host": "109.71.254.64:1337",
        "uri": "109.71.254.64:1337",
        "headers": {}
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Connection": [
            "close"
        ],
        "Location": [
            "https://109.71.254.64/"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ]
    }
}
2024/06/18 06: 56: 24.979 INFO http.log.access handled request {
    "request": {
        "remote_ip": "115.231.78.12",
        "remote_port": "9252",
        "client_ip": "115.231.78.12",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.2623.112 Safari/537.36"
            ],
            "Accept": [
                "/"
            ],
            "Connection": [
                "keep-alive"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 06: 57: 49.834 INFO http.log.access handled request {
    "request": {
        "remote_ip": "115.231.78.12",
        "remote_port": "54118",
        "client_ip": "115.231.78.12",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 QIHU 360SE"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ],
            "Connection": [
                "close"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 06: 57: 50.480 INFO http.log.access handled request {
    "request": {
        "remote_ip": "115.231.78.12",
        "remote_port": "31210",
        "client_ip": "115.231.78.12",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/favicon.ico",
        "headers": {
            "Accept-Encoding": [
                "gzip"
            ],
            "Connection": [
                "close"
            ],
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 QIHU 360SE"
            ],
            "Accept": [
                "/"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/favicon.ico"
        ],
        "Content-Type": []
    }
}
2024/06/18 07: 00: 52.228 INFO http.log.access handled request {
    "request": {
        "remote_ip": "34.78.249.41",
        "remote_port": "48882",
        "client_ip": "34.78.249.41",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/",
        "headers": {
            "X-Datadog-Trace-Id": [
                "11620240962742083301"
            ],
            "X-Datadog-Parent-Id": [
                "1298632369822916447"
            ],
            "X-Datadog-Sampling-Priority": [
                "1"
            ],
            "User-Agent": [
                "python-requests/2.32.2"
            ],
            "Accept-Encoding": [
                "gzip, deflate"
            ],
            "Accept": [
                "/"
            ],
            "Connection": [
                "keep-alive"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 07: 31: 29.382 INFO http.log.access handled request {
    "request": {
        "remote_ip": "185.224.128.43",
        "remote_port": "36934",
        "client_ip": "185.224.128.43",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46"
            ],
            "Connection": [
                "keep-alive"
            ],
            "X-Requested-With": [
                "XMLHttpRequest"
            ],
            "Content-Type": [
                "application/x-www-form-urlencoded; charset=UTF-8"
            ],
            "Accept-Encoding": [
                "gzip, deflate",
                "gzip, deflate"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Language": [
                "en US,en;q=0.9,sv;q=0.8"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 07: 51: 53.980 INFO http.log.access handled request {
    "request": {
        "remote_ip": "176.101.146.132",
        "remote_port": "37329",
        "client_ip": "176.101.146.132",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 08: 00: 22.705 INFO http.log.access handled request {
    "request": {
        "remote_ip": "167.94.145.107",
        "remote_port": "33462",
        "client_ip": "167.94.145.107",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/",
        "headers": {}
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ]
    }
}
2024/06/18 08: 00: 26.057 INFO http.log.access handled request {
    "request": {
        "remote_ip": "167.94.145.107",
        "remote_port": "53586",
        "client_ip": "167.94.145.107",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 08: 00: 26.409 INFO http.log.access handled request {
    "request": {
        "remote_ip": "167.94.145.107",
        "remote_port": "53616",
        "client_ip": "167.94.145.107",
        "proto": "HTTP/2.0",
        "method": "PRI",
        "host": "",
        "uri": "",
        "headers": {}
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://"
        ],
        "Content-Type": []
    }
}
2024/06/18 08: 15: 45.649 INFO http.log.access handled request {
    "request": {
        "remote_ip": "185.244.36.221",
        "remote_port": "54924",
        "client_ip": "185.244.36.221",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/",
        "headers": {}
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ]
    }
}
2024/06/18 08: 20: 14.278 INFO http.log.access handled request {
    "request": {
        "remote_ip": "185.221.219.197",
        "remote_port": "52200",
        "client_ip": "185.221.219.197",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/nacos/v1/console/namespaces",
        "headers": {
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ],
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/115.0"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/nacos/v1/console/namespaces"
        ],
        "Content-Type": []
    }
}
2024/06/18 10: 16: 17.928 INFO http.log.access handled request {
    "request": {
        "remote_ip": "188.132.191.199",
        "remote_port": "53341",
        "client_ip": "188.132.191.199",
        "proto": "HTTP/1.1",
        "method": "CONNECT",
        "host": "api.ipify.org:443",
        "uri": "api.ipify.org:443",
        "headers": {
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip, deflate"
            ],
            "User-Agent": [
                "Python/3.12 aiohttp/3.9.5"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Content-Type": [],
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://api.ipify.org/"
        ]
    }
}
2024/06/18 10: 20: 49.774 INFO http.log.access handled request {
    "request": {
        "remote_ip": "185.180.140.5",
        "remote_port": "53304",
        "client_ip": "185.180.140.5",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/",
        "headers": {
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ],
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 10: 20: 51.250 INFO http.log.access handled request {
    "request": {
        "remote_ip": "185.180.140.5",
        "remote_port": "42718",
        "client_ip": "185.180.140.5",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/wp-content/plugins/elementor/readme.txt",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/wp-content/plugins/elementor/readme.txt"
        ],
        "Content-Type": []
    }
}
2024/06/18 11: 32: 30.501 INFO http.log.access handled request {
    "request": {
        "remote_ip": "172.206.143.20",
        "remote_port": "59170",
        "client_ip": "172.206.143.20",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/manager/text/list",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 zgrab/0.x"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/manager/text/list"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ]
    }
}
2024/06/18 11: 32: 42.694 INFO http.log.access handled request {
    "request": {
        "remote_ip": "185.242.226.99",
        "remote_port": "56903",
        "client_ip": "185.242.226.99",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0.0010331,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 11: 39: 25.048 INFO http.log.access handled request {
    "request": {
        "remote_ip": "205.185.123.220",
        "remote_port": "57066",
        "client_ip": "205.185.123.220",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/",
        "headers": {
            "Accept-Encoding": [
                "gzip, deflate"
            ],
            "Connection": [
                "close"
            ],
            "Upgrade-Insecure-Requests": [
                "1"
            ],
            "User-Agent": [
                "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0"
            ],
            "Accept": [
                "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8"
            ],
            "Accept-Language": [
                "en-GB,en;q=0.5"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ]
    }
}
2024/06/18 11: 42: 31.212 INFO http.log.access handled request {
    "request": {
        "remote_ip": "168.232.15.168",
        "remote_port": "8300",
        "client_ip": "168.232.15.168",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
            ],
            "Content-Length": [
                "0"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ]
    }
}
2024/06/18 11: 50: 47.590 INFO http.log.access handled request {
    "request": {
        "remote_ip": "209.38.136.64",
        "remote_port": "58906",
        "client_ip": "209.38.136.64",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 11: 50: 47.629 INFO http.log.access handled request {
    "request": {
        "remote_ip": "209.38.136.64",
        "remote_port": "58908",
        "client_ip": "209.38.136.64",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/form.html",
        "headers": {
            "Accept-Encoding": [
                "gzip"
            ],
            "User-Agent": [
                "curl/8.1.2"
            ],
            "Accept": [
                "/"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0.0005484,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Content-Type": [],
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/form.html"
        ]
    }
}
2024/06/18 11: 50: 47.650 INFO http.log.access handled request {
    "request": {
        "remote_ip": "209.38.136.64",
        "remote_port": "58918",
        "client_ip": "209.38.136.64",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/upl.php",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/upl.php"
        ],
        "Content-Type": []
    }
}
2024/06/18 11: 50: 47.690 INFO http.log.access handled request {
    "request": {
        "remote_ip": "209.38.136.64",
        "remote_port": "58936",
        "client_ip": "209.38.136.64",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/geoip/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/geoip/"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ]
    }
}
2024/06/18 11: 50: 47.712 INFO http.log.access handled request {
    "request": {
        "remote_ip": "209.38.136.64",
        "remote_port": "58938",
        "client_ip": "209.38.136.64",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/favicon.ico",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Content-Type": [],
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/favicon.ico"
        ]
    }
}
2024/06/18 11: 50: 47.734 INFO http.log.access handled request {
    "request": {
        "remote_ip": "209.38.136.64",
        "remote_port": "58942",
        "client_ip": "209.38.136.64",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/1.php",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0.0007883,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/1.php"
        ],
        "Content-Type": []
    }
}
2024/06/18 11: 50: 47.755 INFO http.log.access handled request {
    "request": {
        "remote_ip": "209.38.136.64",
        "remote_port": "58952",
        "client_ip": "209.38.136.64",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/bundle.js",
        "headers": {
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ],
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0.0006091,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/bundle.js"
        ],
        "Content-Type": []
    }
}
2024/06/18 11: 50: 47.778 INFO http.log.access handled request {
    "request": {
        "remote_ip": "209.38.136.64",
        "remote_port": "58966",
        "client_ip": "209.38.136.64",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/files/",
        "headers": {
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ],
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/files/"
        ],
        "Content-Type": []
    }
}
2024/06/18 11: 50: 47.799 INFO http.log.access handled request {
    "request": {
        "remote_ip": "209.38.136.64",
        "remote_port": "58982",
        "client_ip": "209.38.136.64",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/systembc/password.php",
        "headers": {
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ],
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/systembc/password.php"
        ],
        "Content-Type": []
    }
}
2024/06/18 11: 50: 47.819 INFO http.log.access handled request {
    "request": {
        "remote_ip": "209.38.136.64",
        "remote_port": "58992",
        "client_ip": "209.38.136.64",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/password.php",
        "headers": {
            "Accept-Encoding": [
                "gzip"
            ],
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
            ],
            "Accept": [
                "/"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/password.php"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ]
    }
}
2024/06/18 11: 50: 47.841 INFO http.log.access handled request {
    "request": {
        "remote_ip": "209.38.136.64",
        "remote_port": "59008",
        "client_ip": "209.38.136.64",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/info.php",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
            ],
            "Accept": [
                "/"
            ],
            "Accept-Encoding": [
                "gzip"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Location": [
            "https://{MY_IP_ADDR}/info.php"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ]
    }
}
2024/06/18 11: 58: 54.683 INFO http.log.access handled request {
    "request": {
        "remote_ip": "45.237.159.129",
        "remote_port": "44489",
        "client_ip": "45.237.159.129",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/",
        "headers": {
            "Content-Length": [
                "0"
            ],
            "User-Agent": [
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": [],
        "Server": [
            "Caddy"
        ]
    }
}
2024/06/18 11: 59: 20.474 INFO http.log.access handled request {
    "request": {
        "remote_ip": "35.240.50.242",
        "remote_port": "39850",
        "client_ip": "35.240.50.242",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}",
        "uri": "/",
        "headers": {
            "Connection": [
                "keep-alive"
            ],
            "X-Datadog-Trace-Id": [
                "12236746035339455929"
            ],
            "X-Datadog-Parent-Id": [
                "14077094174865104908"
            ],
            "X-Datadog-Sampling-Priority": [
                "0"
            ],
            "User-Agent": [
                "python-requests/2.32.2"
            ],
            "Accept-Encoding": [
                "gzip, deflate"
            ],
            "Accept": [
                "/"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 12: 12: 09.216 INFO http.log.access handled request {
    "request": {
        "remote_ip": "83.97.73.245",
        "remote_port": "37096",
        "client_ip": "83.97.73.245",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
            ],
            "Accept-Encoding": [
                "gzip"
            ],
            "Connection": [
                "close"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ],
        "Content-Type": []
    }
}
2024/06/18 12: 21: 05.104 INFO http.log.access handled request {
    "request": {
        "remote_ip": "83.97.73.245",
        "remote_port": "36716",
        "client_ip": "83.97.73.245",
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "{MY_IP_ADDR}:80",
        "uri": "/",
        "headers": {
            "User-Agent": [
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
            ],
            "Accept-Encoding": [
                "gzip"
            ],
            "Connection": [
                "close"
            ]
        }
    },
    "bytes_read": 0,
    "user_id": "",
    "duration": 0,
    "size": 0,
    "status": 308,
    "resp_headers": {
        "Content-Type": [],
        "Server": [
            "Caddy"
        ],
        "Connection": [
            "close"
        ],
        "Location": [
            "https://{MY_IP_ADDR}/"
        ]
    }
}

There are a lot more, but this is pretty much what I’m getting constantly.

3. Caddy version:

Caddy 2.8.4

4. How I installed and ran Caddy:

Downloaded Caddy along with geofilter plugin from website.
Ran on Windows using caddy.exe run --config Caddyfile

a. System environment:

Windows 11

b. Command:

caddy.exe run --config Caddyfile

d. My complete Caddy config:

(geofilter) {
    @geofilter {
      not maxmind_geolocation {
        db_path "C:\Users\need4swede\Caddy\geolite\GeoLite2-Country.mmdb"
        allow_countries US
      }
    }
    respond @geofilter 403 {
        body "Access Denied"
    }
}

(block_ip) {
    @blockedIPs {
        remote_ip 185.191.0.0/16 152.203.6.118 31.220.1.83 45.148.0.0/16
    }
    respond @blockedIPs 403
}

(block_agents) {
    @blockedUserAgents {
        header User-Agent *Go-http-client* *python-requests* *CensysInspect* *zgrab* *Expanse* *curl* *Mozilla/5.0* *Windows NT 10.0*
    }
    respond @blockedUserAgents 403
}

(block_paths) {
    @blockedPaths {
        path /cgi-bin/* /wp-content/plugins/* /vendor/phpunit/* /solr/admin/* /manager/text/*
    }
    respond @blockedPaths 403
}

(block_root) {
    @blockedRoot {
        path /
    }
    respond @blockedRoot 403
}

beacons.minastirith.net {
    encode gzip
    reverse_proxy 127.0.0.1:5050
    import geofilter
    import block_ip
    import block_agents
    import block_paths
    import block_root
}

If I try to access my site from outside of my home network using a VPN to mask as a different country, it does block my access - but I also don’t see anything show up in my log. But I see a lot of these requests from Russia and other countries show up in my Caddylog. I also want to block certain agents, but that doesn’t seem to be working either.

Any help would be greatly appreciate to help me secure my sites! Thanks!

That’s not a valid matcher, you can’t pass a list of values to header. If you want to match more than one value pattern, then you need to specify header User-Agent more than once inside your matcher, or use a header_regexp matcher instead.

Every request I see in your logs is just HTTP requests (not HTTPS) getting served an HTTP->HTTPS redirect. That seems to be working just fine. There’s no problem here.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.