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

Increasing maxHeaderSize for downstream requests #481

Closed
mxku opened this issue Aug 8, 2018 · 8 comments
Closed

Increasing maxHeaderSize for downstream requests #481

mxku opened this issue Aug 8, 2018 · 8 comments

Comments

@mxku
Copy link

mxku commented Aug 8, 2018

I have a use case where spring-cloud-gateway injects some headers in the request for authentication/authorization purpose. In some case, the size of these headers is going beyond 8KB which make gateway throw http 400 in those cases.

I did go through issue #402 and tried that option. But this seems related to changing the header size that gateway itself will accept and not what it will be routing to downstream services.

The downstream services in my case have max-http-headers-size as 0, tomcat based spring-boot applications, hence they aren't rejecting. Is there any configuration option or component that I can add to customize this behaviour?

@mxku mxku changed the title Increasing maxHeaderSize for requests Increasing maxHeaderSize for downstream requests Aug 8, 2018
@ryanjbaxter
Copy link
Contributor

This is really a Netty/Spring Boot question and not a Spring Cloud Gateway question.

Try

	@Configuration
	public class ServerConfiguration {

		@Bean
		public NettyServerCustomizer serverCustomizer() {
			return options -> options.maxHeaderSize(1000);
		}
	}

See spring-projects/spring-boot#9955 (comment)

@mxku
Copy link
Author

mxku commented Aug 8, 2018

@ryanjbaxter Thanks. But wouldn't customizing through NettyServerConfiguration will alter the header size that cloud gateway will accept. I have issue when header size in downstream request exceeds 8KB. As in my case, cloud gateway injects some authentication related headers before forwarding the request to downstream services.

I couldn't find any way to customize the HttpClient.

@spencergibb
Copy link
Member

We have support for the server side, @MANISHONLINE is this specifically for the client side? Can you share the exception?

@tony-clarke-amdocs
Copy link
Contributor

@MANISHONLINE DId you find a way to adjust the max size?

@spencergibb
Copy link
Member

spencergibb commented Nov 27, 2018

@violetagg or @smaldini?

@violetagg
Copy link
Contributor

Currently we do not provide a way for changing these settings for the client.
If you need that, please create a GitHub issue. Also once we add it, Gateway has to provide also a way for changing these settings.

@tony-clarke-amdocs
Copy link
Contributor

Thanks reactor/reactor-netty#531

@Fraser-Chapman
Copy link

Did @mxku find a fix for this in the end? I'm struggling with this in my app and raised an issue: #3418

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

No branches or pull requests

6 participants