Skip to content

Commit b0a0009

Browse files
committed
disable middlebox_comp_mode in mix httpc
1 parent 3dc3f4e commit b0a0009

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/mix/lib/mix/utils.ex

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,11 +738,21 @@ defmodule Mix.Utils do
738738
file -> {:cacertfile, file}
739739
end
740740

741-
# Use the system certificates
741+
# disable middlebox compatibility mode by default
742+
# but allow it to be enabled via an environment variable
743+
# see https://github.com/elixir-lang/elixir/issues/14356
744+
middlebox_comp_mode =
745+
case System.get_env("HEX_MIDDLEBOX_COMP_MODE") do
746+
t when t in ["true", "t", "yes", "y", "1"] -> true
747+
_ -> false
748+
end
749+
750+
# Use the system certificates and set the middlebox compatibility mode
742751
ssl_options = [
743752
cacert_opt,
744753
verify: :verify_peer,
745-
customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)]
754+
customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)],
755+
middlebox_comp_mode: middlebox_comp_mode
746756
]
747757

748758
# We are using relaxed: true because some servers is returning a Location

0 commit comments

Comments
 (0)