Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions config/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,20 @@ https_only: false
# path: /tmp/invidious.sock
# permissions: 777

##
## Maximum size of the HTTP request line (in bytes).
## Increase this value if you encounter 414 errors when using URLs with long
## query parameters (e.g., very long continuation tokens).
##
## Note: This directly sets the HTTP server's max_request_line_size.
## Be cautious when increasing this value on public instances.
##
## Accepted values: integer (size in bytes)
## Default: 8192 (8KB, Crystal's default)
## Recommended: 16384 (16KB) if experiencing 414 errors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think any default recommendations is needed here. Imo instances should decide this value according to their own requirements and needs if they decide to stray from the default 8 kilobytes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about now that Youtube started to return a even larger continuation string (#5529)? 16384 seems like is a must now. Unless we adapt Invidious channel next page button to use a POST request to go to the next page with it's continuation as a body.

Copy link
Member

@unixfox unixfox Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also in favor of a hardcoded value. This way we know everyone is on the same page.

##
#max_request_line_size: 16384

Comment on lines +201 to +207
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value should reflect the actual default value of 8192


# -----------------------------
# Network (outbound)
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ services:
# Please read the following file for a comprehensive list of all available
# configuration options and their associated syntax:
# https://github.com/iv-org/invidious/blob/master/config/config.example.yml
# Uncomment to increase max request line size (if you get 414 errors):
# INVIDIOUS_MAX_REQUEST_LINE_SIZE: 16384
INVIDIOUS_CONFIG: |
db:
dbname: invidious
Expand Down
5 changes: 5 additions & 0 deletions src/invidious.cr
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ Kemal.config.app_name = "Invidious"
{% end %}

Kemal.run do |config|
# Set max request line size if configured
if max_size = CONFIG.max_request_line_size
config.server.not_nil!.max_request_line_size = max_size
end

if socket_binding = CONFIG.socket_binding
File.delete?(socket_binding.path)
# Create a socket and set its desired permissions
Expand Down
2 changes: 2 additions & 0 deletions src/invidious/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ class Config
property host_binding : String = "0.0.0.0"
# Path and permissions to make Invidious listen on a UNIX socket instead of a TCP port
property socket_binding : SocketBindingConfig? = nil
# Maximum size of request line (in bytes), increase if you get 414 errors with long URLs
property max_request_line_size : Int32? = nil
# Pool size for HTTP requests to youtube.com and ytimg.com (each domain has a separate pool of `pool_size`)
property pool_size : Int32 = 100
# HTTP Proxy configuration
Expand Down