Skip to content

Commit

Permalink
#LUC065-109 Changed the header from X-Forwarded-For to NS-X-Forwarded…
Browse files Browse the repository at this point in the history
…-For

1) Made the change in ExportEventProcessor.getBaseParameters
  • Loading branch information
dspeed2 committed Feb 23, 2024
1 parent d6e5074 commit 8b330a2
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down

0 comments on commit 8b330a2

Please sign in to comment.