shenyu icon indicating copy to clipboard operation
shenyu copied to clipboard

How to configure max-initial-line-length in Shenyu Gateway?

Open titxue opened this issue 1 year ago • 2 comments

Question

I am encountering an issue with the default HTTP request line length limit in Shenyu (version 2.6.1). When a request URI exceeds 4096 bytes, I receive the following error:

2024-12-18 13:30:48.761  WARN 14228 --- [nyu-netty-nio-2] r.n.http.server.HttpServerOperations     : [d7d12014, L:/127.0.0.1:9195 - R:/127.0.0.1:59507] Decoding failed: FULL_REQUEST(decodeResult: failure(io.netty.handler.codec.http.TooLongHttpLineException: An HTTP line is larger than 4096 bytes.), version: HTTP/1.0, content: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 0, widx: 0, cap: 0))
GET /bad-request HTTP/1.0

I resolved this by modifying Netty's max-initial-line-length parameter using the following configuration in my server settings:

server:
  netty:
    max-initial-line-length: 409600

However, I couldn't find an equivalent configuration in Shenyu for this parameter. Could you please guide me on how to configure max-initial-line-length in Shenyu or if it's possible to extend this setting via custom configuration or plugin?

titxue avatar Dec 18 '24 05:12 titxue

Do you mean that adding this configuration parameter in Shenyu is ineffective?

xcsnx avatar Jan 14 '25 07:01 xcsnx

You should add the configuration max-initial-line-length: 409600 to both the bootstrap and downstream services to resolve the issue.

xcsnx avatar Jan 14 '25 07:01 xcsnx