Skip to content

Don't copy the response Transfer-Encoding header #47

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

Merged
merged 1 commit into from
Jun 2, 2016
Merged

Don't copy the response Transfer-Encoding header #47

merged 1 commit into from
Jun 2, 2016

Conversation

himdel
Copy link
Contributor

@himdel himdel commented Feb 18, 2016

This stops express-http-proxy from preserving the response's
Transfer-Encoding header.

Without this, when express-http-proxy tries to proxy a response with
Transfer-Encoding: chunked set, the response is de-chunked by waiting
on all the chunks and joining them, indeed, a Content-Length header is
computed and set if intercepting. But trying to send a response with
both Content-Length and Transfer-Encoding: chunked fails with a
Parse error, because it doesn't make sense.

Thus, we explicitly skip copying over Transfer-Encoding.

(For example, Puma with Rails 5 always sends replies that way.)

This stops `express-http-proxy` from preserving the response's
`Transfer-Encoding` header.

Without this, when `express-http-proxy` tries to proxy a response with
`Transfer-Encoding: chunked` set, the response is de-chunked by waiting
on all the chunks and joining them, indeed, a Content-Lenght header is
computed and set if intercepting. But trying to send a response with
both `Content-Length` and `Transfer-Encodign: chunked` fails with a
`Parse error`, because it doesn't make sense.

Thus, we explicitly skip copying over `Transfer-Encoding`.
@patrickhousley
Copy link

Any chance on getting this merged and released soon?

@himdel
Copy link
Contributor Author

himdel commented Apr 7, 2016

I'm ..becoming sure that express-http-proxy is dead, we've switched over to node-http-proxy since (which doesn't have the issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants