-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add ability to set max response HTTP Header Size on httpclient #1457
Comments
It should be |
It still does not work. I tried to debug the Netty source code and the customization is taken but ignored. I noticed that a further customization is added: Class EmbeddedWebServerFactoryCustomizerAutoConfiguration:
Class NettyWebServerFactoryCustomizer
Also in this case maximum header size is set and also in this case it is ignored then by Netty. |
so, not sure this is a gateway issue, maybe boot or reactor netty? |
it would seem so |
@philwebb or @simonbasle or @smaldini thoughts on where this might end up? |
I'm having a hard time reading the issue, can you fix the markdown formatting? |
Sorry for formatting, I tried to fix it. |
Thanks @biagioT, can you also put the three backticks (```) around the stacktrace? That's the area I'm most interested in reviewing. |
done |
I give you more information about my problem, hoping it will be useful: the error occurs when I invoke a rest service (obviously passing through the gateway) with a bearer token (15 kb) in the request header; the service is performed correctly and at the end of the execution inserts the token (the same or refreshed) in the response header but something happens after that. So it might seem that the gateway lets pass the request but not the response. (Should we also increase HttpResponseDecoderSpec maxHeaderSize?) |
The I think we ideally could do with a way to replicate the issue ourselves then we can assign it to the appropriate team. @biagioT Would you be able to share some code that reproduces the problem so that we can debug it locally. It doesn't need to be your real application (in fact it's better if it's not), it just need to be something that we can run locally. |
I created the following project: https://github.com/biagioT/spring-cloud-test |
Thanks very much for the sample @biagioT. It looks to me like this isn't a Spring Boot issue but something that will need changes in Spring Clould Gateway. The customization that you're configuring are getting applied, but the problem is that the exception is thrown from client component of Spring Cloud Gateway, not the server part. I think Spring Cloud Gateway needs to configure the It looks to me like the I must admit. I don't know the reactor netty code all that well so I might be wrong. Here's the relevent stack trace showing where the
|
@spencergibb I think this issue needs to stay in spring-cloud-gateway |
Thanks for the support. For now I have solved the problem by defining the HttpClient bean, identical to GatewayAutoConfiguration definition but with an addition:
|
Hi guys Thanks a lot for the workaround.It saved us from a bad situation just before the release. I struggled a bit though, to get it working, because we were using spring cloud 'Greenwich.Release' which packaged io.projectreactor.netty:reactor-netty:0.8.5.RELEASE but since the httpResponseDecoder() API is exposed only in 0.8.9.RELEASE version or later, I naively added io.projectreactor.netty:reactor-netty:0.8.9.RELEASE as explict dependency, but then gateway started throwing 400 Bad request for every request. Finally relaized that I had to upgrade the full webflux stack, so updating the springBootVersion to "2.1.6.RELEASE" upgraded the webflux to '2.1.6.RELEASE' which packaged '0.8.9.RELEASE' version of reactor-netty. Cheers |
@yhnsatish upgrade to Greenwich.SR4 |
It's 2024 and I just had the same issue with my spring cloud gateway (spring boot 3.3.1). During backend execution (after the gateway) we add a custom token to the response (way bigger then 8KB) and we observed the exact same behaviour. I did some deep source code analysis to find anything to customize, and then I found the Setting the property |
I can't increase the value of 'max header size' in my Spring Cloud Gateway (Netty based).
Following the suggestions of other threads I tried to write this component:
The result is the following:
"TooLongFrameException: HTTP header is larger than 8192 bytes"
Stacktrace:
Spring cloud version: Greenwich.RELEASE (I also tried with Hoxton.RELEASE).
The text was updated successfully, but these errors were encountered: