diff options
| author | Hannah Isopod <me@bathynomus.xyz> | 2026-02-15 22:42:27 -0700 |
|---|---|---|
| committer | Hannah Isopod <me@bathynomus.xyz> | 2026-02-15 22:42:27 -0700 |
| commit | 3b606bcc096a6d9860672e6d0d003ca9e80c067e (patch) | |
| tree | 17746584c25a0d165c0feaf884f33c1578aa4f04 /blog/posts/guide_blocking_user_agents_nginx/index.md | |
| parent | 16e48ed8655528a81cbec84f0cbc1a211d663b37 (diff) | |
THE BIG ONE
Total website redesign.
Multiple new blog posts.
Routine updates on several pages.
Too much to list, even if I remembered it all.
Remind me not to put this git repo on any portfolios.
Diffstat (limited to 'blog/posts/guide_blocking_user_agents_nginx/index.md')
| -rw-r--r-- | blog/posts/guide_blocking_user_agents_nginx/index.md | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/blog/posts/guide_blocking_user_agents_nginx/index.md b/blog/posts/guide_blocking_user_agents_nginx/index.md index 763ea4d..cb022ee 100644 --- a/blog/posts/guide_blocking_user_agents_nginx/index.md +++ b/blog/posts/guide_blocking_user_agents_nginx/index.md @@ -4,7 +4,7 @@ The way I've chosen to deal with this is to just configure my reverse proxy, Ngi I'm assuming here that you already know the basics of configuring Nginx, otherwise this article won't really be of much use to you. -## How to do it +# How to do it Paste this into the main `server` block of your Nginx config to instantly drop the connection to any client with a "Wildebeest" (case insensitive) user agent: @@ -16,11 +16,11 @@ if ($http_user_agent ~* (wildebeest)) { } ``` -## More configuration +# More configuration If all you want is to block Wildebeest and forget about it, you can leave now. If you want to customize this behavior further, read on. -### Different HTTP responses +## Different HTTP responses 444 is a custom response code in Nginx that just drops the connection immediately. You can use any other HTTP error code you like, for example to return a `403 Forbidden` error: @@ -40,7 +40,7 @@ Or just to be silly :3 return 418; ``` -### Block multiple user agents +## Block multiple user agents You can also block multiple user agents in one statement like so: @@ -52,7 +52,7 @@ if ($http_user_agent ~* (wildebeest|GPTBot)) { } ``` -### Includes +## Includes One thing I'd recommend doing is moving all your user agent blocks to a separate file that you can include in all your Nginx sites. I place this file at `/etc/nginx/includes/bans`: |
