Elixir Tesla: Proxy Authentication with the Mint Adapter
Put the Basic header on the Mint adapter's connection options so it can accompany CONNECT before the destination request.
basic = "Basic " <> Base.encode64(proxy_user <> ":" <> proxy_password)
client = Tesla.client([], {Tesla.Adapter.Mint, [
proxy: {:http, "proxy.example", 8080, []},
proxy_headers: [{"proxy-authorization", basic}]
]})Use this Tesla client for the application's intended operations. Their URLs remain service destinations; proxy_user and proxy_password name the intermediary account.
Mint applies proxy_headers to CONNECT for a tunnel proxy, or merges them into requests in forwarding mode. A generic Tesla destination-header middleware is not that earlier connection input.
The example uses Basic. Base64 is a representation, not encryption; protection depends on the proxy connection's transport.
Keep these options with the Mint adapter. Substituting Finch, Hackney or another adapter requires its interface, and destination Authorization remains a different authentication exchange.