Skip to content

[ISSUE #5856] Support configurable max-initial-line-length for HTTP request decoder#6378

Open
hqbhonker wants to merge 1 commit into
apache:masterfrom
hqbhonker:fix/issue-5856-max-initial-line-length
Open

[ISSUE #5856] Support configurable max-initial-line-length for HTTP request decoder#6378
hqbhonker wants to merge 1 commit into
apache:masterfrom
hqbhonker:fix/issue-5856-max-initial-line-length

Conversation

@hqbhonker

Copy link
Copy Markdown

Description

This PR adds support for configuring the HTTP request decoder properties in ShenYu Gateway, resolving the issue where HTTP requests with long URLs (exceeding 4096 bytes) are rejected.

Changes

shenyu-common

  • Added HttpDecoderProperties inner class to NettyHttpProperties with:
    • maxInitialLineLength (default: 4096)
    • maxHeaderSize (default: 8192)
    • maxChunkSize (default: 8192)

shenyu-spring-boot-starter-gateway

  • Modified ShenyuNettyWebServerConfiguration to apply httpRequestDecoder settings from configuration
  • Added test case for the new httpDecoder properties

shenyu-bootstrap

  • Added example configuration in application.yml

Configuration Example

shenyu:
  netty:
    http:
      httpDecoder:
        maxInitialLineLength: 8192
        maxHeaderSize: 16384
        maxChunkSize: 16384

How to Test

  1. Configure shenyu.netty.http.httpDecoder.maxInitialLineLength=8192 in application.yml
  2. Send an HTTP request with a URL longer than 4096 bytes
  3. The request should be processed successfully instead of being rejected

Checklist

  • Code follows the project's coding style
  • Unit tests added
  • Configuration example updated
  • Backward compatible (uses Netty default values when not configured)

Closes #5856

Add HTTP request decoder configuration support including:
- maxInitialLineLength (default 4096)
- maxHeaderSize (default 8192)
- maxChunkSize (default 8192)

Users can now configure these properties via application.yml:
  shenyu.netty.http.httpDecoder.maxInitialLineLength=8192

This resolves the issue where HTTP requests with URLs exceeding
4096 bytes are rejected by the gateway.

Closes apache#5856
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

Successfully merging this pull request may close these issues.

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

1 participant