diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 7d174cca4..db49ccfae 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -269,7 +269,6 @@ defp http_children do |> Config.get([]) |> Pleroma.HTTP.AdapterHelper.add_pool_size(pool_size) |> Pleroma.HTTP.AdapterHelper.maybe_add_proxy_pool(proxy) - |> Pleroma.HTTP.AdapterHelper.maybe_add_cacerts(:public_key.cacerts_get()) |> Keyword.put(:name, MyFinch) [{Finch, config}] diff --git a/lib/pleroma/http.ex b/lib/pleroma/http.ex index 5ef7b188d..9346ffa16 100644 --- a/lib/pleroma/http.ex +++ b/lib/pleroma/http.ex @@ -62,6 +62,13 @@ def request(method, url, body, headers, options) when is_binary(url) do uri = URI.parse(url) adapter_opts = AdapterHelper.options(uri, options || []) + adapter_opts = + if uri.scheme == :https do + AdapterHelper.maybe_add_cacerts(adapter_opts, :public_key.cacerts_get()) + else + adapter_opts + end + options = put_in(options[:adapter], adapter_opts) params = options[:params] || [] request = build_request(method, headers, options, url, body, params)