Skip to content

feat: Add configurable max_request_line_size to handle 414 errors #5394

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hellosunghyun
Copy link

Summary

This PR adds a configurable max_request_line_size option to handle 414 (URI Too Long) errors that occur with very long continuation tokens in API requests.

Problem

Users are experiencing 414 errors when accessing channel videos with long continuation tokens. The default HTTP request line size limit (8KB) is insufficient for some YouTube continuation tokens, which can be extremely long.

Example error:

414 Client Error: URI Too Long for url: http://localhost:8080/api/v1/channels/UChQ-VMvdGrYZxviQVMTJOHg/videos?sort_by=newest&continuation=4qmFsgLT...

Solution

  • Added max_request_line_size configuration option to the Config class
  • Modified server initialization to apply the custom limit if configured
  • Provided clear documentation and examples for both config.yml and environment variable usage

Configuration

Users can now configure the limit in three ways:

  1. In config.yml:
max_request_line_size: 16384  # 16KB
  1. Via environment variable:
INVIDIOUS_MAX_REQUEST_LINE_SIZE=16384
  1. In docker-compose.yml:
environment:
  INVIDIOUS_MAX_REQUEST_LINE_SIZE: 16384

Default Behavior

  • The default behavior remains unchanged (8KB limit)
  • Only users experiencing 414 errors need to configure this option
  • Conservative default ensures security for public instances

Testing

  • Tested with long continuation tokens that previously caused 414 errors
  • Verified that the configuration is properly applied from all sources (config.yml, env var)
  • Confirmed that default behavior is maintained when option is not set

Security Considerations

  • Added documentation warning about increasing this value on public instances
  • The option is intentionally not enabled by default to maintain security posture

This change provides a flexible solution for users experiencing URL length issues without affecting existing installations.

Fixes issues related to long continuation tokens in channel video pagination.

This commit adds a new configuration option `max_request_line_size` that allows
users to increase the HTTP request line size limit. This is particularly useful
for handling very long continuation tokens that can cause 414 (URI Too Long) errors.

Changes:
- Add `max_request_line_size` property to Config class
- Configure Kemal server to use the custom limit if specified
- Document the option in config.example.yml with recommendations
- Add examples in docker-compose.yml for both YAML and env var configuration

The default behavior remains unchanged (8KB limit) unless explicitly configured.
This provides a solution for users experiencing 414 errors without affecting
existing installations.
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.

1 participant