[
https://issues.apache.org/jira/browse/KNOX-2102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16969368#comment-16969368
]
Sandeep More commented on KNOX-2102:
------------------------------------
In the past Knox has been omitting sending content length headers back, this is
because there is no way for Knox to know what the content length would be after
rewrite. In the response going out Knox [prevents setting content-length
header|https://github.com/apache/knox/blob/master/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponse.java#L74]
we should either prevent it or set it to 0 (which is what I thought Knox did
all along). But this behavior appears to be broken.
> Issue with Content-Length Header when rewriting response body
> -------------------------------------------------------------
>
> Key: KNOX-2102
> URL: https://issues.apache.org/jira/browse/KNOX-2102
> Project: Apache Knox
> Issue Type: Bug
> Reporter: In Park
> Priority: Minor
>
> Content-Length value is preserved although response body is rewritten by
> KNOX. This causes a content length mismatch error.
> DefaultDispatch.copyResponseHeaderFields() copies the Content-Length header
> from the original response regardless of whether rewrite happens or not.
> *workaround*: This can be worked around by configuring the dispatch to
> exclude this header.
> {code:java}
> <dispatch classname="org.apache.knox.gateway.dispatch.ConfigurableDispatch">
> <param>
> <name>responseExcludeHeaders</name>
> <value>CONTENT-LENGTH</value>
> </param>
> </dispatch>
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)