{"id":34613720,"url":"https://github.com/mkalus/caddy_block_aws","last_synced_at":"2026-05-22T23:32:36.678Z","repository":{"id":271385839,"uuid":"913260914","full_name":"mkalus/caddy_block_aws","owner":"mkalus","description":"Automatically block all calls from AWS servers in your Caddy server","archived":false,"fork":false,"pushed_at":"2025-10-01T06:52:36.000Z","size":69,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-01T08:41:37.743Z","etag":null,"topics":["blocker","caddy","caddy-plugin"],"latest_commit_sha":null,"homepage":"https://caddyserver.com/docs/modules/http.handlers.blockaws","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkalus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-07T10:43:20.000Z","updated_at":"2025-10-01T06:52:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"669ebcff-9bd9-4824-ae1b-4c6d62d3db6c","html_url":"https://github.com/mkalus/caddy_block_aws","commit_stats":null,"previous_names":["mkalus/caddy_block_aws"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/mkalus/caddy_block_aws","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkalus%2Fcaddy_block_aws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkalus%2Fcaddy_block_aws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkalus%2Fcaddy_block_aws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkalus%2Fcaddy_block_aws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkalus","download_url":"https://codeload.github.com/mkalus/caddy_block_aws/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkalus%2Fcaddy_block_aws/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33376119,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-22T21:56:13.512Z","status":"ssl_error","status_checked_at":"2026-05-22T21:56:10.769Z","response_time":265,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blocker","caddy","caddy-plugin"],"created_at":"2025-12-24T14:19:27.449Z","updated_at":"2026-05-22T23:32:36.673Z","avatar_url":"https://github.com/mkalus.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Caddy Block AWS Cloud\n\nAutomatically block all calls from AWS servers in your Caddy server.\n\nI created this [Caddy Server](https://caddyserver.com/) module to automatically get rid of bot calls from the AWS cloud.\nUnfortunately, it looks like AWS is used by many crawler bots to crawl your site. In case of\n[Memorial Archives](https://memorial-archives.international/), I wanted to get rid of those calls, because they are\nsimply unwanted.\n\nThe module loads the official AWS ip range file from https://ip-ranges.amazonaws.com/ip-ranges.json and parses it. AWS\ncontains over 8000 ip ranges, so an efficient ip matching is required. I use\n[Ryo Namiki's ipfilter](https://github.com/paralleltree/ipfilter) for this, since it implements an efficient binary tree\nsearch.\n\n## TODOs\n\nThere are still some todos to implement/check:\n\n* [ ] Periodic update of the data: Right now, the AWS ip list only loaded once. It should be updated once in a while.\n* [x] Caching? Check if it is faster to cache ips once they are checked in the binary tree (especially on misses).\n* [ ] Configurable settings (for cache, omission of ipv4/ipv6)\n\n## Requirements\n\n* Go\n* xcaddy: `go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest`\n\n\n## Usage\n\nThe module implements a simple directive `blockaws` to be included in your caddy file. Since this is a third party\ndirective, you have to tell Caddy when to add the directive using the global `order` setting.\n\nHere is a simple example (also found in [Caddyfile](./Caddyfile)):\n\n```\n{\n\torder blockaws after header\n\tauto_https off\n}\n\nhttp://localhost:2015 {\n\tblockaws\n\n\trespond \"Hello, world!\"\n}\n```\n\nCompile your custom Caddy server using:\n\n```shell\nxcaddy build --with github.com/mkalus/caddy_block_aws@main\n```\n\nOptionally, you can also create this by checking out the repository and build from local code:\n\n```shell\nxcaddy build --with github.com/mkalus/caddy_block_aws=.\n```\n\nAnd run it:\n\n```shell\n./caddy run\n```\nYou should see a log entry http.handlers.blockaws  Loaded AWS IP ranges` - this shows that the directive has been loaded\ncorrectly.\n\n## Compiling from Source\n\nYou can clone this repository and run:\n\n```bash\nxcaddy run\n```\n\nYou should see a log entry http.handlers.blockaws  Loaded AWS IP ranges` - this shows that the directive has been loaded\ncorrectly.\n\nYou can test with:\n\n```bash\ncurl -v localhost:2015\n```\n\nIf you try this from an AWS server, your request *should* be blocked. Building from a local repo is done via:\n\n```bash\nxcaddy build --with github.com/mkalus/caddy_block_aws=.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkalus%2Fcaddy_block_aws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkalus%2Fcaddy_block_aws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkalus%2Fcaddy_block_aws/lists"}