Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to anything with Gun adapter using HTTP proxy #552

Open
howaboutlollmao opened this issue Dec 6, 2022 · 1 comment
Open

Comments

@howaboutlollmao
Copy link

howaboutlollmao commented Dec 6, 2022

Tesla and Gun both with latest commits from master branch, but the same can be seen with Tesla 1.4.4 and Gun 2.0.0-rc1.

gun_client = Tesla.client([], Tesla.Adapter.Gun)
Tesla.get(gun_client, "http://icanhazip.com", opts: [adapter: [timeout: 3_000, proxy: {{127, 0, 0, 1}, 8118}]])

Running this in IEX returns {:error, :recv_response_timeout} no matter what the URL is. SOCKS proxies work fine, the problem is only with HTTP.
ninenines/gun#300 might be related, since the symptoms are similar (connection is created, but no request to end server is made).

@tanguilp
Copy link
Contributor

tanguilp commented Jul 5, 2024

Not a solution to your problem, but you can use httpc instead from Tesla v1.11:

def get_adapter(uri) do
  profile = uri |> to_string() |> String.to_atom()
  {:ok, _pid} = :inets.start(:httpc, profile: profile)
  :httpc.set_options([https_proxy: {{to_charlist(uri.host), uri.port}, []}], profile)
  {Tesla.Adapter.Httpc, profile: profile}
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants