aboutsummaryrefslogtreecommitdiff
path: root/blog/posts/guide_blocking_user_agents_nginx/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'blog/posts/guide_blocking_user_agents_nginx/index.md')
-rw-r--r--blog/posts/guide_blocking_user_agents_nginx/index.md10
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`: