Add forward headers support

This commit is contained in:
Donal McBreen
2024-07-31 10:44:48 +01:00
committed by Donal McBreen
parent 268ec1c6e0
commit d891eb91e4
2 changed files with 9 additions and 1 deletions

View File

@@ -91,3 +91,10 @@ proxy:
max_request_body: 40_000_000
max_response_body: 0
memory: 2_000_000
# Forward headers
#
# Whether to forward the X-Forwarded-For and X-Forwarded-Proto headers (defaults to false)
#
# If you are behind a trusted proxy, you can set this to true to forward the headers.
forward_headers: true

View File

@@ -48,7 +48,8 @@ class Kamal::Configuration::Proxy
"buffer": proxy_config.fetch("buffer", { enabled: true }).fetch("enabled", true),
"buffer-memory": proxy_config.dig("buffer", "memory"),
"max-request-body": proxy_config.dig("buffer", "max_request_body"),
"max-response-body": proxy_config.dig("buffer", "max_response_body")
"max-response-body": proxy_config.dig("buffer", "max_response_body"),
"forward-headers": proxy_config.dig("forward_headers")
}.compact
end