Lobste.rs

How I protect my forgejo instance from AI Web Crawlers

SCALE_UI_Layout

TL;DR:Put that in your nginx config:location / { # needed to still allow git clone from http/https URLs if ($http_user_agent ~* “git/|git-lfs/”) { set $bypass_cookie 1; } # If we see the expected cookie; we could also bypass the blocker page if ($cookie_Yogsototh_opens_the_door = “1”) { set $bypass_cookie 1; } # Redirect to 418 if neither condition is met if ($bypass_cookie != 1) { add_header Content-Type text/html always; return 418 ‘<script>document.cookie = “Yogsototh_opens_the_door=1; Path=/;”; window.location.reload();</script>’; } # rest of your nginx config Preferably run a string replace from Yogsototh_opens_the_door to your own personal Cookie name.Main advantage, is that it is almost invisible to the users of my website compartively to other solutions like…

Continue reading at Lobste.rs her.esy.fun
Advertisement