From c25c86c2894ca14089ce6b6421c19ae9abddc6d4 Mon Sep 17 00:00:00 2001 From: Lens0021 / Leslie Date: Sat, 28 Sep 2024 01:55:27 +0900 Subject: [PATCH] Block Claudebot (#263) --- caddy/Caddyfile | 6 ++++++ jobs/http.nomad | 29 +++++------------------------ 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/caddy/Caddyfile b/caddy/Caddyfile index 66bfed6f..5672c120 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -50,6 +50,9 @@ rewrite /w/* /index.php path / vars_regexp {query} ^[A-Z]{5}=[A-Z]{3}$ } +@filter2 { + header User-Agent *ClaudeBot* +} respond @filter0 200 { close @@ -57,3 +60,6 @@ respond @filter0 200 { respond @filter1 200 { close } +respond @filter2 200 { + close +} diff --git a/jobs/http.nomad b/jobs/http.nomad index 4276177a..de8c58c9 100644 --- a/jobs/http.nomad +++ b/jobs/http.nomad @@ -26,41 +26,22 @@ job "http" { } dynamic "template" { - for_each = !var.test ? [] : [{ - data = var.caddyfile_for_test - destination = "local.Caddyfile" - }] + for_each = !var.test ? [] : [{}] content { - data = template.value.data - destination = template.value.destination + data = var.caddyfile_for_test + destination = "local.Caddyfile" } } dynamic "artifact" { - for_each = var.test ? [] : [{ - source = "https://github.com/femiwiki/nomad/raw/main/caddy/Caddyfile" - destination = "local/Caddyfile" - mode = "file" - }] + for_each = var.test ? [] : [{}] content { - source = artifact.value.source - destination = artifact.value.destination - mode = artifact.value.mode - } - } - - dynamic "artifact" { - for_each = var.test ? [] : [{ source = "https://github.com/femiwiki/nomad/raw/main/caddy/Caddyfile" destination = "local/Caddyfile" mode = "file" - }] - content { - source = artifact.value.source - destination = artifact.value.destination - mode = artifact.value.mode + options { checksum = "md5:ee0300e384afa6aca74f09a44323ee6e" } } }