Skip to content
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

Respect already set content-length header for HEAD request. #23484

Closed
TYsewyn opened this issue Aug 19, 2019 · 2 comments
Closed

Respect already set content-length header for HEAD request. #23484

TYsewyn opened this issue Aug 19, 2019 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@TYsewyn
Copy link

TYsewyn commented Aug 19, 2019

Currently when making a downstream request from Spring Cloud Gateway, the content-length HTTP header is being overwritten by org.springframework.http.server.reactive.HttpHeadResponseDecorator. Ideally this decorator should not kick in when the header was already set manually, or otherwise.
Also see spring-cloud/spring-cloud-gateway#1210.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 19, 2019
@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 19, 2019
@rstoyanchev rstoyanchev self-assigned this Aug 19, 2019
@rstoyanchev rstoyanchev added this to the 5.1.10 milestone Aug 19, 2019
@rstoyanchev
Copy link
Contributor

rstoyanchev commented Aug 19, 2019

Come to think of it, we still need to wait for data buffers to be attempted to be written in order to release them. The question is what should happen if there are data buffers and an existing content-length header?

@TYsewyn I believe in your case there is no data to be written since you're simply passing through a response from the downstream which has a content-length but no data otherwise. So the change could be to respect an existing content-length if no content was written but otherwise just use the calculated length. That would keep it pretty close to the existing behavior with an improvement to use a suggested content-length when there is no data.

@TYsewyn
Copy link
Author

TYsewyn commented Aug 19, 2019

Yep, I believe that was the use case of the issued ticket at SC Gateway. I think your proposed solution would be perfect. If the downstream service does send data then it would make sense to recalculate the content length since that's the content the gateway received.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants