From 5d3793e46254b8b8056306ffe75137e7b91ca4d9 Mon Sep 17 00:00:00 2001 From: aiotter Date: Thu, 31 Jul 2025 18:29:25 +0900 Subject: [PATCH] fix: preserve_host_header option omits port number from the original header --- lib/reverse_proxy_plug.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/reverse_proxy_plug.ex b/lib/reverse_proxy_plug.ex index 389f39b..2a681d5 100644 --- a/lib/reverse_proxy_plug.ex +++ b/lib/reverse_proxy_plug.ex @@ -255,7 +255,8 @@ defmodule ReverseProxyPlug do proxy_req_host = if options[:preserve_host_header] do - conn.host + {"host", host} = List.keyfind(conn.req_headers, "host", 0, {"host", conn.host}) + host else host_header_from_url(url) end