Add user-agent blocking for dealing with webscrapers
Change-Id: I9c26791a9f96bb2e87f0f427f7ff4adcb46a2b9e
diff --git a/templates/vhost.conf.j2 b/templates/vhost.conf.j2
index 94ea8da..142e74a 100644
--- a/templates/vhost.conf.j2
+++ b/templates/vhost.conf.j2
@@ -79,6 +79,11 @@
access_log {{ nginx_log_dir }}/{{ item.name }}_access.log;
error_log {{ nginx_log_dir }}/{{ item.name }}_error.log;
+ # user agent (webscraper) blocks
+ if ($http_user_agent ~* {{ blocked_user_agents }}) {
+ return 403;
+ }
+
{% if item.extra_config is defined and item.extra_config %}
# extra config
{{ item.extra_config | indent(2) }}