From b3377dab488f1147325fafdf8983f9e40b20314c Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Fri, 6 Sep 2024 21:20:51 +0800 Subject: [PATCH] tyo0/redlib: block search indexing --- hosts/tyo0/services/redlib.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hosts/tyo0/services/redlib.nix b/hosts/tyo0/services/redlib.nix index 7adcd16..27d50bc 100644 --- a/hosts/tyo0/services/redlib.nix +++ b/hosts/tyo0/services/redlib.nix @@ -13,9 +13,17 @@ in match = lib.singleton { host = [ "reddit.ny4.dev" ]; }; - handle = lib.singleton { - handler = "reverse_proxy"; - upstreams = [ { dial = "localhost:${toString port}"; } ]; - }; + handle = [ + { + # Google's indexing caused a DoS with 800k requests... + # https://developers.google.com/search/docs/crawling-indexing/block-indexing + handler = "headers"; + response.set."X-Robots-Tag" = [ "noindex" ]; + } + { + handler = "reverse_proxy"; + upstreams = [ { dial = "localhost:${toString port}"; } ]; + } + ]; }; }