[ https://issues.apache.org/jira/browse/KNOX-2559?focusedWorklogId=575699&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-575699 ]
ASF GitHub Bot logged work on KNOX-2559: ---------------------------------------- Author: ASF GitHub Bot Created on: 01/Apr/21 19:19 Start Date: 01/Apr/21 19:19 Worklog Time Spent: 10m Work Description: mudit-97 commented on a change in pull request #423: URL: https://github.com/apache/knox/pull/423#discussion_r605890578 ########## File path: gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/AbstractGatewayDispatch.java ########## @@ -132,12 +134,22 @@ public void copyRequestHeaderFields(HttpUriRequest outboundRequest, outboundRequest.addHeader( name, value ); } } + + //If there are some headers to be appended, append them + Map<String, String> extraHeaders = getOutboundRequestAppendHeaders(); + if(null != extraHeaders){ Review comment: ack, used MapUtils.isNotEmpty ########## File path: gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/AbstractGatewayDispatch.java ########## @@ -132,12 +134,22 @@ public void copyRequestHeaderFields(HttpUriRequest outboundRequest, outboundRequest.addHeader( name, value ); } } + + //If there are some headers to be appended, append them + Map<String, String> extraHeaders = getOutboundRequestAppendHeaders(); + if(null != extraHeaders){ + extraHeaders.keySet().forEach(header -> outboundRequest.addHeader(header, extraHeaders.get(header))); Review comment: ack ########## File path: gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/AbstractGatewayDispatch.java ########## @@ -132,12 +134,22 @@ public void copyRequestHeaderFields(HttpUriRequest outboundRequest, outboundRequest.addHeader( name, value ); } } + + //If there are some headers to be appended, append them + Map<String, String> extraHeaders = getOutboundRequestAppendHeaders(); Review comment: ack ########## File path: gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/ConfigurableDispatch.java ########## @@ -41,13 +47,26 @@ public class ConfigurableDispatch extends DefaultDispatch { private Set<String> requestExcludeHeaders = super.getOutboundRequestExcludeHeaders(); private Set<String> responseExcludeHeaders = super.getOutboundResponseExcludeHeaders(); + private Map<String, String> requestAppendHeaders = new HashMap<>(); Review comment: ack -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 575699) Time Spent: 50m (was: 40m) > Adding functionality to append headers in Configurable Dispatch > --------------------------------------------------------------- > > Key: KNOX-2559 > URL: https://issues.apache.org/jira/browse/KNOX-2559 > Project: Apache Knox > Issue Type: Improvement > Reporter: Mudit Sharma > Assignee: Mudit Sharma > Priority: Major > Attachments: > 0001-KNOX-2559-Added-functionality-to-append-headers-in-r.patch > > Time Spent: 50m > Remaining Estimate: 0h > > Hi, We are using Apache Knox to guardrail our perimeter for our Hadoop > Cluster. As part of this we are abstracting out many APIs and putting them > behind Knox > We had a requirement where we want to append some service specific headers in > the API calls before Knox submits it to the service. Livy had a similar > implementation but Livy created a whole new Dispatcher to do this > We have different APIs and different set of headers for all of them. We are > suggesting to enlarge scope of current ConfigurableDispatcher to also allow > one more param: > > <param> > <name>requestAppendHeaders</name> > <value>\{"a":"b"}</value> > </param> > > If given above param, Knox while submitting the request to the service, will > add these headers along with the request -- This message was sent by Atlassian Jira (v8.3.4#803005)