From 61b1d5bb6121f00df78b5ececce564ffb8f89949 Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Sun, 18 Feb 2024 23:04:35 -0800 Subject: [PATCH] netty (fix): Support reading up to 64kb HTTP header --- .../scala/wvlet/airframe/http/netty/NettyServer.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/airframe-http-netty/src/main/scala/wvlet/airframe/http/netty/NettyServer.scala b/airframe-http-netty/src/main/scala/wvlet/airframe/http/netty/NettyServer.scala index 12a9bc4df..f2675764a 100644 --- a/airframe-http-netty/src/main/scala/wvlet/airframe/http/netty/NettyServer.scala +++ b/airframe-http-netty/src/main/scala/wvlet/airframe/http/netty/NettyServer.scala @@ -261,7 +261,15 @@ class NettyServer(config: NettyServerConfig, session: Session) extends HttpServe val pipeline = ch.pipeline() // pipeline.addLast(new IdleStateHandler(1, 1, 60, TimeUnit.SECONDS)) - pipeline.addLast(new HttpServerCodec()) // 4096, 8192, Int.MaxValue, false)) + pipeline.addLast( + new HttpServerCodec( + 4096, // the same with Netty's default MAX_INITIAL_LINE_LENGTH + 64 * 1024, // Upto ALB's max request header size + // No need to limit the chunk size in Netty. Ref https://github.com/twitter/finagle/commit/990c8650366e5374ea062c753a4628c5971fc40e + Int.MaxValue, + false // Skip header validation + ) + ) // pipeline.addLast(new HttpServerKeepAliveHandler()) pipeline.addLast(new HttpObjectAggregator(Int.MaxValue)) pipeline.addLast(new HttpContentCompressor())