Created
February 28, 2025 13:57
-
-
Save felipekm/134df87d321b8a4f39c623f3ab0f646a to your computer and use it in GitHub Desktop.
NGINX - Block bad bots and unwanted scrapers by filtering User-Agents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
location /api/ { | |
if ($http_user_agent ~* (curl|wget|bot|crawler)) { | |
return 403; # Block known scrapers and bots | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment