Skip to content

Commit 97b214e

Browse files
Nicholas Barrowfilipecabaco
andauthored
fix: override max_header_value_length using environment variable (#762)
Update runtime.exs to allow a `MAX_HEADER_LENGTH` env variable Solves #761 by introducing an environment variable to override config -> http -> protocol_options -> max_header_value_length or leaves it at the default 4096 if no other value is specified --------- Co-authored-by: Filipe Cabaço <[email protected]>
1 parent 23bb692 commit 97b214e

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ TAILSCALE_APP_NAME # {string} Name of the Tailscale app.
144144
TAILSCALE_AUTHKEY # {string} Auth key for the Tailscape app.
145145
DNS_NODES # {string} Node name used when running server in a cluster.
146146
MAX_CONNECTIONS # {string} Set the soft maximum for WebSocket connections. Defaults to '16384'.
147+
MAX_HEADER_LENGTH # {string} Set the maximum header length for connections (in bytes). Defaults to '4096'.
147148
NUM_ACCEPTORS # {string} Set the number of server processes that will relay incoming WebSocket connection requests. Defaults to '100'.
148149
DB_QUEUE_TARGET # {string} Maximum time to wait for a connection from the pool. Defaults to '5000' or 5 seconds. See for more info: https://hexdocs.pm/db_connection/DBConnection.html#start_link/2-queue-config.
149150
DB_QUEUE_INTERVAL # {string} Interval to wait to check if all connections were checked out under DB_QUEUE_TARGET. If all connections surpassed the target during this interval than the target is doubled. Defaults to '5000' or 5 seconds. See for more info: https://hexdocs.pm/db_connection/DBConnection.html#start_link/2-queue-config.

config/runtime.exs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ if config_env() == :prod do
2828
url: [host: "#{app_name}.fly.dev", port: 80],
2929
http: [
3030
port: String.to_integer(System.get_env("PORT") || "4000"),
31+
protocol_options: [
32+
max_header_value_length: String.to_integer(System.get_env("MAX_HEADER_LENGTH") || "4096")
33+
],
3134
transport_options: [
3235
# max_connection is per connection supervisor
3336
# num_conns_sups defaults to num_acceptors

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule Realtime.MixProject do
44
def project do
55
[
66
app: :realtime,
7-
version: "2.25.49",
7+
version: "2.25.50",
88
elixir: "~> 1.14.0",
99
elixirc_paths: elixirc_paths(Mix.env()),
1010
start_permanent: Mix.env() == :prod,

0 commit comments

Comments
 (0)