From ce4e1d42876d0cacb626109e2d5085f1729f315b Mon Sep 17 00:00:00 2001 From: Phantasm Date: Fri, 24 Jul 2026 16:03:57 +0200 Subject: [PATCH] ReverseProxy Tesla: Explicitly reformat proxy --- lib/pleroma/reverse_proxy/client/tesla.ex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/pleroma/reverse_proxy/client/tesla.ex b/lib/pleroma/reverse_proxy/client/tesla.ex index 24168e367..941d23ea2 100644 --- a/lib/pleroma/reverse_proxy/client/tesla.ex +++ b/lib/pleroma/reverse_proxy/client/tesla.ex @@ -6,6 +6,7 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do @behaviour Pleroma.ReverseProxy.Client alias Pleroma.Gun.ConnectionPool + alias Pleroma.HTTP.AdapterHelper @type headers() :: [{String.t(), String.t()}] @type status() :: pos_integer() @@ -20,6 +21,13 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do def request(method, url, headers, body, opts \\ []) do check_adapter() + # MediaProxyController inserts MediaProxy proxy configuration into the ReverseProxy call. + # This config can be unformatted and in String representation, while this works for Hackney, + # it does not work for Tesla and the proxy needs to be reformatted. + # Gun AdapterHelper doesn't do it, since it does not overwrite proxy config. + proxy = AdapterHelper.format_proxy(opts[:proxy]) + opts = if proxy, do: Keyword.put(opts, :proxy, proxy), else: opts + opts = Keyword.put(opts, :body_as, :chunks) with {:ok, response} <-