diff --git a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/ClientWorker.java b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/ClientWorker.java index 4c0a841ae5..a5e8d59ecd 100644 --- a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/ClientWorker.java +++ b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/ClientWorker.java @@ -181,7 +181,7 @@ public int compare(String o1, String o2) { }); for (Map.Entry headerEntry : headerEntries) { - if (headerMap.containsKey(headerEntry.getKey())) { + if (headerMap.containsKey(headerEntry.getKey()) && !conf.isIgnoreCaseSensitiveHeaders()) { excessHeaders.put(headerEntry.getKey(), headerMap.get(headerEntry.getKey())); } headerMap.put(headerEntry.getKey(), headerEntry.getValue()); diff --git a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfigPNames.java b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfigPNames.java index 931e1d32e4..57f65026d4 100644 --- a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfigPNames.java +++ b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfigPNames.java @@ -177,4 +177,9 @@ public interface PassThroughConfigPNames { * Defines whether viewing services are enabled or not */ public String BLOCK_SERVICE_LIST = "http.block_service_list"; + + /** + * Defines whether to ignore case-sensitive headers from excess headers map + */ + public String IGNORE_CASE_SENSITIVE_HEADERS = "ignore_case_sensitive_headers"; } diff --git a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfiguration.java b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfiguration.java index d1268e6fdd..6d739ec433 100644 --- a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfiguration.java +++ b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/config/PassThroughConfiguration.java @@ -387,4 +387,14 @@ public String getPassThroughDefaultServiceName() { } return passThroughDefaultServiceName; } + + /** + * Get the value of the property to ignore case-sensitive headers from excess headers + * + * @return Value of the property + */ + public boolean isIgnoreCaseSensitiveHeaders() { + return ConfigurationBuilderUtil.getBooleanProperty(PassThroughConfigPNames.IGNORE_CASE_SENSITIVE_HEADERS, + false, props); + } }