From 35a7c4367f81982aa80b07aae03515a33b4fc506 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Tue, 22 Dec 2020 10:24:17 +0100
Subject: [PATCH] Encapsulate ip in apache access log to cover proxy forwarded
 multiple ips separated by comma and space

---
 templates/vhost.conf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/templates/vhost.conf b/templates/vhost.conf
index 22a50c8..1d38e8a 100644
--- a/templates/vhost.conf
+++ b/templates/vhost.conf
@@ -22,7 +22,7 @@
 {% if apache_version|default('2.4') == '2.4' %}
   ErrorLogFormat "[%{u}t] [%l] [pid %P] [client\ %{X-Forwarded-For}i] %M% ,\ referer:\ %{Referer}i"
 {% endif %}
-  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
+  LogFormat "\"%{X-Forwarded-For}i\" %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
   ErrorLog {{ apacheLogDir }}/{{ drupal_domain.domain }}-error.log
   CustomLog {{ apacheLogDir }}/{{ drupal_domain.domain }}-access.log combined env=!forwarded
   CustomLog {{ apacheLogDir }}/{{ drupal_domain.domain }}-access.log proxy env=forwarded
@@ -170,7 +170,7 @@
 {% if apache_version|default('2.4') == '2.4' %}
   ErrorLogFormat "[%{u}t] [%l] [pid %P] [client\ %{X-Forwarded-For}i] %M% ,\ referer:\ %{Referer}i"
 {% endif %}
-  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
+  LogFormat "\"%{X-Forwarded-For}i\" %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
   ErrorLog {{ apacheLogDir }}/{{ drupal_domain.domain }}-error.log
   CustomLog {{ apacheLogDir }}/{{ drupal_domain.domain }}-access.log combined env=!forwarded
   CustomLog {{ apacheLogDir }}/{{ drupal_domain.domain }}-access.log proxy env=forwarded
-- 
GitLab