caddyanubis

package module
v0.0.0-...-4848f99 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2025 License: ISC Imports: 10 Imported by: 0

README

caddy-anubis

caddy-anubis is a plugin that loads anubis for requests in order to slow down AI and Scraper traffic from destroying infrastucture.

I consider this current implementation more of a Proof-of-Concept. I am not sure how stable or well it works. This is my first Caddy plugin. I do not currently recommend it for production usage.

If you have experience with Caddy plugins, or see obvious issues in my code, feel free to open PRs or reach out to me.

Known Issues

  • One major issue is the very first request after a Caddy start or restart, takes like 5 seconds till anubis kicks in. All subsequent requests, even after clearing cookies, are near instant.

Current usage

Just add an anubis to your caddyfile in the block you want the protection. currently I have not seen it work properly inside a route or handler block. But it works outside of those.

There is an optional target field you can set if you want to force the redirect elsewhere. It does a 302 redirect.

Example (also check the caddyfile in this repo, it is used for testing):


:80 {
  anubis

  # or 

  anubis {
    target https://qwant.com
  }
}

Credits

  • anubis - the project that started all of this.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnubisMiddleware

type AnubisMiddleware struct {
	Target       *string `json:"target,omitempty"`
	AnubisPolicy *policy.ParsedConfig
	AnubisServer *libanubis.Server
	Next         caddyhttp.Handler
	// contains filtered or unexported fields
}

func (AnubisMiddleware) CaddyModule

func (AnubisMiddleware) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*AnubisMiddleware) Provision

func (m *AnubisMiddleware) Provision(ctx caddy.Context) error

Provision implements caddy.Provisioner.

func (*AnubisMiddleware) ServeHTTP

ServeHTTP implements caddyhttp.MiddlewareHandler.

func (*AnubisMiddleware) UnmarshalCaddyfile

func (m *AnubisMiddleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

func (*AnubisMiddleware) Validate

func (m *AnubisMiddleware) Validate() error

Validate implements caddy.Validator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL