Stevie-Ray / referrer-spam-blocker

Apache, Nginx, IIS, uWSGI, Caddy & Varnish blacklist + Google Analytics segments to prevent referrer spam traffic 🤖
MIT License
374 stars 86 forks source link

Add a version for Caddy 2 #133

Closed Pierstoval closed 2 years ago

Pierstoval commented 2 years ago

Description

I updated the Generator.php script (and re-executed it afterwards) to add Caddy 2 configuration support

Motivation and Context

The include keyword doesn't exist anymore in Caddy 2, it was replaced by import, and semicolons are removed too

How Has This Been Tested?

I tested it on my dedicated server, I added the rule to site configs and curl-ed it:

debian@piers:/etc/caddy$ curl -I https://stars.pierstoval.com  -H "Referer: 03e.info"
HTTP/2 444
alt-svc: h3=":443"; ma=2592000
content-type: text/plain; charset=utf-8
server: Caddy
content-length: 15
date: Mon, 26 Sep 2022 12:31:03 GMT

Technically, you can do the same curl call on your own machine and it should do the same.

Types of changes

Checklist:

Stevie-Ray commented 2 years ago

LGTM