From 8b330a2f7db5cb4e70da087a88d1d055994134c6 Mon Sep 17 00:00:00 2001 From: David Speed Date: Fri, 23 Feb 2024 11:41:01 +0000 Subject: [PATCH] #LUC065-109 Changed the header from X-Forwarded-For to NS-X-Forwarded-For 1) Made the change in ExportEventProcessor.getBaseParameters --- .../statistics/export/processor/ExportEventProcessor.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dspace-api/src/main/java/org/dspace/statistics/export/processor/ExportEventProcessor.java b/dspace-api/src/main/java/org/dspace/statistics/export/processor/ExportEventProcessor.java index 609298779d34..d40d8b9a6ada 100644 --- a/dspace-api/src/main/java/org/dspace/statistics/export/processor/ExportEventProcessor.java +++ b/dspace-api/src/main/java/org/dspace/statistics/export/processor/ExportEventProcessor.java @@ -106,17 +106,19 @@ protected void processObject(String urlParameters) throws IOException, SQLExcept protected String getBaseParameters(Item item) throws UnsupportedEncodingException { + // DAS 20240223 Added this to allow us to change the default header from X-Forwarded-For + String ipHeaderLabel = "NS-X-Forwarded-For"; //We have a valid url collect the rest of the data String clientIP = request.getRemoteAddr(); if (configurationService.getBooleanProperty("useProxies", false) && request - .getHeader("X-Forwarded-For") != null) { + .getHeader(ipHeaderLabel) != null) { /* This header is a comma delimited list */ - for (String xfip : request.getHeader("X-Forwarded-For").split(",")) { + for (String xfip : request.getHeader(ipHeaderLabel).split(",")) { /* proxy itself will sometime populate this header with the same value in remote address. ordering in spec is vague, we'll just take the last not equal to the proxy */ - if (!request.getHeader("X-Forwarded-For").contains(clientIP)) { + if (!request.getHeader(ipHeaderLabel).contains(clientIP)) { clientIP = xfip.trim(); } }