harsh facts require harsh responses :) caddy plugin
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Norwin 7c949d257a update chromeish user agent matcher
context: https://vivaldi.com/blog/user-agent-changes/
9 months ago
.gitignore init 3 years ago
LICENSE Initial commit 3 years ago
README.md docs: how to build 2 years ago
go.mod init 3 years ago
go.sum init 3 years ago
handler.go more reasonable timeouts 3 years ago
ips_dynamic.go allow dynamically fetching google IP ranges via SPF 3 years ago
ips_static.go allow dynamically fetching google IP ranges via SPF 3 years ago
matcher.go update chromeish user agent matcher 9 months ago

README.md

...after the great success of hits like 'don't be evil', 'making the world a better place', and 'the market regulates itself', presenting:

caddy-google-is-broken

Caddy plugin to fuck google over in most ways available to an average ops person. To that end it provides a request handler fuck-google, as well as a request matcher google when more customization is needed.

Yes, it's somewhat ironic I wrote this as a plugin for Caddy, software that was an early adopter of google's extend- extinguish-protocols like http2. So is life; ironic.

building caddy with this plugin

  • set up a tiny go project and import this plugin (follow steps described here), or..
  • use xcaddy: xcaddy build --with git.nroo.de/norwin/caddy-google-is-broken

handler

The handler automatically applies a couple measures (some of which may deem familiar) to traffic from google servers and/or clients using google's products. There are several degrees of fuckuppery, default is maximum fuckup (just as is googles default).

fuck google... a teeny tiny bit fuck them for real all the way
451 all reqs from google IPs n n y y
451 all reqs from GoogleBot n y y y
beg for no FLoC y y y why even try
delay reqs of chrome users by 50ms 150ms 700ms 1400ms
delay reqs of blink users by - - - 1400ms
delay reqs of google search users by - 150ms 700ms 1400ms
delay reqs of google service users by - - - 1400ms
your idea..? ? ? ? ?

usage

  • Caddyfile:
    example.com {
        route {                    
            fuck-google for real
            file_server            # ..or other handlers serving your content.
        }
    }
    
    Instead of wrapping things in a route block, you can also specify an order block at the top of your Caddyfile:
    { order fuck-google before basicauth }
    
  • JSON: ..., "handle": [{ "handler": "fuck_google", "level": "a teeny tiny bit" }, ...]

matcher

The matcher can be used like any other matcher in Caddy. It doesn't do anything that couldn't be done with Caddy's builtin matchers, but provides much more convenience.

usage

By default all matching options are disabled. Multiple options apply an OR set.

  • Caddyfile
    google [googlebot] [ip-ranges] [ua-chrome] [ua-chromeish] [referer-google] [referer-other]
    
    google {
        [googlebot]
        [ip-ranges]
        [ua-chrome]
        [ua-chromeish]
        [referer-google]
        [referer-other]
    }
    
    example:
    @goog {
        method GET
        google ua-chrome referer-google
    }
    route @goog {
        file_server
    }
    
  • JSON:
    {
      "handle": ...,
      "match": [{
        "google": {
          "googlebot": true
          "ip_ranges": true
          "useragent_chrome": true
          "useragent_chromeish": true
          "referer_google": true
          "referer_other": true
        }
      }]
    }
    

For the ip-ranges match method, by default a static list of CIDR netblocks are shipped with the plugin. If you want to future proof yourself at the cost of caddy startup time (~100ms), build caddy with GOFLAGS=-tags=dyngoogips.

license

Unlicense