From e3cf34414b73f7f3847a23fb02e5c509d93f5e92 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Fri, 19 Apr 2024 13:50:30 -0700 Subject: [PATCH] Use UA filter in mailman apache vhost We're noticing that mailman's uwsgi queue is filling up. Before we try to extend the queue apply our user agent filter to apache to reduce the number of requests that hit the queue in the first place. Change-Id: Ib821a7fffa6239a9affcc4c6698eef2dc9378cd1 --- playbooks/roles/mailman3/tasks/main.yaml | 5 +++++ playbooks/roles/mailman3/templates/mailman.vhost.j2 | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/playbooks/roles/mailman3/tasks/main.yaml b/playbooks/roles/mailman3/tasks/main.yaml index d94c0560ec..b15ef26d50 100644 --- a/playbooks/roles/mailman3/tasks/main.yaml +++ b/playbooks/roles/mailman3/tasks/main.yaml @@ -164,6 +164,11 @@ - apache2-utils state: present +- name: Add UA filter macro to apache config + # This is used in the mailman apache vhost. + include_role: + name: apache-ua-filter + - name: Apache modules apache2_module: state: present diff --git a/playbooks/roles/mailman3/templates/mailman.vhost.j2 b/playbooks/roles/mailman3/templates/mailman.vhost.j2 index 0182ecf718..ca3bd57c85 100644 --- a/playbooks/roles/mailman3/templates/mailman.vhost.j2 +++ b/playbooks/roles/mailman3/templates/mailman.vhost.j2 @@ -12,6 +12,8 @@ CustomLog ${APACHE_LOG_DIR}/{{ mailman_sites.0.listdomain }}-access.log combined + Use UserAgentFilter + # Use mod rewrite to redirect as we want to preserve the FQDN for each # mm3 vhost. RewriteEngine On @@ -45,6 +47,10 @@ Require local + # This macro relies on mod rewrite rules so put it before any of the + # actual rewrites we want to perform. + Use UserAgentFilter + RewriteEngine On RewriteRule ^/robots.txt$ /var/www/robots/robots.txt [L] RewriteRule "/pipermail/(.*)" "/var/lib/mailman/web-data/mm2archives/%{HTTP_HOST}/public/$1"