[
https://issues.apache.org/jira/browse/KNOX-2960?focusedWorklogId=882859&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-882859
]
ASF GitHub Bot logged work on KNOX-2960:
----------------------------------------
Author: ASF GitHub Bot
Created on: 02/Oct/23 10:05
Start Date: 02/Oct/23 10:05
Worklog Time Spent: 10m
Work Description: zeroflag opened a new pull request, #798:
URL: https://github.com/apache/knox/pull/798
## What changes were proposed in this pull request?
Incoming Headers are not going through when using OPTIONS type HTTP requests.
## How was this patch tested?
Sandbox topology
```xml
<service>
<role>HIVE</role>
<url>http://localhost:1701/headers</url>
<param>
<name>replayBufferSize</name>
<value>8</value>
</param>
</service>
```
Test HTTP server that logs out the received headers:
```smalltalk
Teapot on
OPTIONS: '/headers' -> [:req |
req headersDo: [:n :v | Transcript show: ('Received: ', n, '=', v); cr
]. 'OK' ];
start.
```
$ curl -X OPTIONS -u admin:admin-password -H 'My-Header: My-Value' -vk
https://localhost:8443/gateway/sandbox/hive
```
Transcript content:
```
Received: X-Forwarded-Proto=https
Received: X-Forwarded-Port=8443
Received: X-Forwarded-Host=localhost:8443
Received: X-Forwarded-Server=localhost
Received: X-Forwarded-Context=/gateway/sandbox
Received: Accept=*/*
Received: User-Agent=curl/7.64.1
Received: My-Header=My-Value
Received: Authorization=Basic YWRtaW46Kg==
Received: Host=localhost:1701
Received: Connection=Keep-Alive
Received: X-Zinc-Remote-Address=127.0.0.1
```
Issue Time Tracking
-------------------
Worklog Id: (was: 882859)
Remaining Estimate: 0h
Time Spent: 10m
> DefaultDispatch doesn't forward inbound request headers in case of
> requestType=OPTIONS
> --------------------------------------------------------------------------------------
>
> Key: KNOX-2960
> URL: https://issues.apache.org/jira/browse/KNOX-2960
> Project: Apache Knox
> Issue Type: Bug
> Reporter: Attila Magyar
> Assignee: Attila Magyar
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> put/get/etc has copyRequestHeaderFields
> {code}
> @Override
> public void doPut(URI url, HttpServletRequest request, HttpServletResponse
> response)
> throws IOException, URISyntaxException {
> final HttpPut method = new HttpPut(url);
> copyRequestHeaderFields(method, request, addExpect100Continue);
> final HttpEntity entity = createRequestEntity(request,
> addExpect100Continue);
> method.setEntity(entity);
> executeRequestWrapper(method, request, response);
> }
> {code}
> but OPTIONS doesn't
> {code}
> @Override
> public void doOptions(URI url, HttpServletRequest request,
> HttpServletResponse response)
> throws IOException, URISyntaxException {
> HttpOptions method = new HttpOptions(url);
> executeRequestWrapper(method, request, response);
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)