From 1e9c9e91038f35310acd6d0334c4d786ca34879a Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Sun, 6 Oct 2024 13:21:49 -0400 Subject: [PATCH] Skip setting the proxy flag when ssl is false Fixes: https://github.com/basecamp/kamal/issues/1037 --- lib/kamal/configuration/proxy.rb | 2 +- test/commands/app_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/kamal/configuration/proxy.rb b/lib/kamal/configuration/proxy.rb index 3870a2de9..6232c3e03 100644 --- a/lib/kamal/configuration/proxy.rb +++ b/lib/kamal/configuration/proxy.rb @@ -29,7 +29,7 @@ def hosts def deploy_options { host: hosts, - tls: proxy_config["ssl"], + tls: proxy_config["ssl"].presence, "deploy-timeout": seconds_duration(config.deploy_timeout), "drain-timeout": seconds_duration(config.drain_timeout), "health-check-interval": seconds_duration(proxy_config.dig("healthcheck", "interval")), diff --git a/test/commands/app_test.rb b/test/commands/app_test.rb index 182c1bb0b..0e5cad796 100644 --- a/test/commands/app_test.rb +++ b/test/commands/app_test.rb @@ -135,6 +135,14 @@ class CommandsAppTest < ActiveSupport::TestCase new_command.deploy(target: "172.1.0.2").join(" ") end + test "deploy with SSL false" do + @config[:proxy] = { "ssl" => false } + + assert_equal \ + "docker exec kamal-proxy kamal-proxy deploy app-web --target=\"172.1.0.2:80\" --deploy-timeout=\"30s\" --drain-timeout=\"30s\" --buffer-requests --buffer-responses --log-request-header=\"Cache-Control\" --log-request-header=\"Last-Modified\" --log-request-header=\"User-Agent\"", + new_command.deploy(target: "172.1.0.2").join(" ") + end + test "remove" do assert_equal \ "docker exec kamal-proxy kamal-proxy remove app-web",