Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#LUC065-109 Changed the header from X-Forwarded-For to NS-X-Forwarded-For #8

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading