From 4fd8701bd94b54ebd3fa00bcf801d30079cbea92 Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Wed, 4 Sep 2024 09:39:10 -0700 Subject: [PATCH 1/2] Issue 51098: Correctly spell "referer" incorrectly (#873) --- server/configs/application.properties | 2 +- server/embedded/src/org/labkey/embedded/LabKeyServer.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/configs/application.properties b/server/configs/application.properties index 531e4b8b5a..8571c6500a 100644 --- a/server/configs/application.properties +++ b/server/configs/application.properties @@ -176,4 +176,4 @@ csp.report=\ ## File-based Tomcat HTTP access logs are enabled by default and use our recommended pattern. Override as needed. #server.tomcat.accesslog.enabled=false -#server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %S %I "%{Referrer}i" "%{User-Agent}i" %{LABKEY.username}s %{X-Forwarded-For}i +#server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %S %I "%{Referer}i" "%{User-Agent}i" %{LABKEY.username}s %{X-Forwarded-For}i diff --git a/server/embedded/src/org/labkey/embedded/LabKeyServer.java b/server/embedded/src/org/labkey/embedded/LabKeyServer.java index 952195f69d..cc83df5202 100644 --- a/server/embedded/src/org/labkey/embedded/LabKeyServer.java +++ b/server/embedded/src/org/labkey/embedded/LabKeyServer.java @@ -75,7 +75,7 @@ public static void main(String[] args) "server.compression.enabled", "true", "server.tomcat.accesslog.enabled", "true", - "server.tomcat.accesslog.pattern", "%h %l %u %t \"%r\" %s %b %D %S %I \"%{Referrer}i\" \"%{User-Agent}i\" %{LABKEY.username}s %{X-Forwarded-For}i", + "server.tomcat.accesslog.pattern", "%h %l %u %t \"%r\" %s %b %D %S %I \"%{Referer}i\" \"%{User-Agent}i\" %{LABKEY.username}s %{X-Forwarded-For}i", "jsonaccesslog.pattern", "%h %t %m %U %s %b %D %S \"%{Referer}i\" \"%{User-Agent}i\" %{LABKEY.username}s %{X-Forwarded-For}i" )); application.setBannerMode(Banner.Mode.OFF); From 4d346be6aa768ca403f317364054d7963974a668 Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Fri, 6 Sep 2024 13:03:29 -0700 Subject: [PATCH 2/2] Issue 51098: Update HTTP access logging to capture true client IP (backport) (#877) * Issue 51098: Update embedded Tomcat HTTP access logging to capture true client IP (#872) * Issue 51098: Correctly spell "referer" incorrectly (#873) --- server/configs/application.properties | 8 ++++---- server/embedded/src/org/labkey/embedded/LabKeyServer.java | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/server/configs/application.properties b/server/configs/application.properties index bf8388b11f..8571c6500a 100644 --- a/server/configs/application.properties +++ b/server/configs/application.properties @@ -121,7 +121,7 @@ management.server.port=@@shutdownPort@@ ## Optional configuration, modeled on the non-JSON Spring Boot properties ## https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties.server.server.tomcat.accesslog.buffered -#jsonaccesslog.pattern=%h %t %m %U %s %b %D %S "%{Referer}i" "%{User-Agent}i" %{LABKEY.username}s +#jsonaccesslog.pattern=%h %t %m %U %s %b %D %S "%{Referer}i" "%{User-Agent}i" %{LABKEY.username}s %{X-Forwarded-For}i #jsonaccesslog.condition-if=attributeName #jsonaccesslog.condition-unless=attributeName @@ -174,6 +174,6 @@ csp.report=\ ## Use a custom logging configuration #logging.config=path/to/alternative/log4j2.xml -## Enable tomcat access log -server.tomcat.accesslog.enabled=true -server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %S %I "%{Referrer}i" "%{User-Agent}i" %{LABKEY.username}s +## File-based Tomcat HTTP access logs are enabled by default and use our recommended pattern. Override as needed. +#server.tomcat.accesslog.enabled=false +#server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %S %I "%{Referer}i" "%{User-Agent}i" %{LABKEY.username}s %{X-Forwarded-For}i diff --git a/server/embedded/src/org/labkey/embedded/LabKeyServer.java b/server/embedded/src/org/labkey/embedded/LabKeyServer.java index 4450e358dc..cc83df5202 100644 --- a/server/embedded/src/org/labkey/embedded/LabKeyServer.java +++ b/server/embedded/src/org/labkey/embedded/LabKeyServer.java @@ -72,8 +72,12 @@ public static void main(String[] args) "server.tomcat.accesslog.directory", logHome, // Enable HTTP compression for response content - "server.compression.enabled", "true" - )); + "server.compression.enabled", "true", + + "server.tomcat.accesslog.enabled", "true", + "server.tomcat.accesslog.pattern", "%h %l %u %t \"%r\" %s %b %D %S %I \"%{Referer}i\" \"%{User-Agent}i\" %{LABKEY.username}s %{X-Forwarded-For}i", + "jsonaccesslog.pattern", "%h %t %m %U %s %b %D %S \"%{Referer}i\" \"%{User-Agent}i\" %{LABKEY.username}s %{X-Forwarded-For}i" + )); application.setBannerMode(Banner.Mode.OFF); application.run(args); }