log message if useProxies is disabled and X-Forwarded-For is set

This commit is contained in:
Roeland Dillen
2016-05-19 11:37:34 +02:00
parent b10fb8d255
commit bde4acf1e4
2 changed files with 14 additions and 1 deletions

View File

@@ -212,6 +212,10 @@ public class ElasticSearchLoggerServiceImpl implements ElasticSearchLoggerServic
} }
} }
if (!isUseProxies() && request.getHeader("X-Forwarded-For") != null){
log.warn("X-Forwarded-For header detected but useProxies is not enabled. If your dspace is behind a proxy set it to true");
}
XContentBuilder docBuilder = null; XContentBuilder docBuilder = null;
@@ -330,6 +334,10 @@ public class ElasticSearchLoggerServiceImpl implements ElasticSearchLoggerServic
} }
} }
if (!isUseProxies() && xforwardedfor != null){
log.warn("X-Forwarded-For header detected but useProxies is not enabled. If your dspace is behind a proxy set it to true");
}
XContentBuilder docBuilder = null; XContentBuilder docBuilder = null;

View File

@@ -303,6 +303,9 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
} }
} }
} }
if (!isUseProxies() && request.getHeader("X-Forwarded-For") != null){
log.warn("X-Forwarded-For header detected but useProxies is not enabled. If your dspace is behind a proxy set it to true");
}
doc1.addField("ip", ip); doc1.addField("ip", ip);
@@ -382,7 +385,9 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
SolrInputDocument doc1 = new SolrInputDocument(); SolrInputDocument doc1 = new SolrInputDocument();
// Save our basic info that we already have // Save our basic info that we already have
if (!isUseProxies() && xforwardedfor != null){
log.warn("X-Forwarded-For header detected but useProxies is not enabled. If your dspace is behind a proxy set it to true");
}
if (isUseProxies() && xforwardedfor != null) { if (isUseProxies() && xforwardedfor != null) {
/* This header is a comma delimited list */ /* This header is a comma delimited list */
for (String xfip : xforwardedfor.split(",")) { for (String xfip : xforwardedfor.split(",")) {