ndan

ndan

Req: how to debug Req.TransportError{reason: :closed} for proxy?

I’m trying to understand why this code works for one provider but not for another

[
  url: "https://ip.smartproxy.com/json",
  connect_options: [
    proxy: {:http, "dc.smartproxy.com", 10001, []},
    transport_opts: [verify: :verify_none],
    proxy_headers: [
      {"Proxy-Authorization", "Basic " <> Base.encode64("username:password")}
    ]
  ],
  retry: false
]
|> Req.get()
# {:error, %Req.TransportError{reason: :closed}}

curl works for both providers:

curl -v -U "username:password" -x "dc.smartproxy.com:10001" "https://ip.smartproxy.com/json"

Is there a verbose option for Req similar to curl --verbose?

Most Liked

ndan

ndan

I fixed it by passing protocols: [:http2] to the connect_options.

Here is the working version:

[
  url: "https://ip.smartproxy.com/json",
  connect_options: [
    proxy: {:http, "dc.smartproxy.com", 1234, []},
    protocols: [:http2],
    transport_opts: [verify: :verify_none],
    proxy_headers: [
      {"Proxy-Authorization", "Basic " <> Base.encode64("username:password")}
    ]
  ],
  retry: false
]
|> Req.get()

But I’m still not sure how to debug similar problems.

Where Next?

Popular in Questions Top

chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New

Other popular topics Top

New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
Qqwy
Update: How to use the Blogs &amp; Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126479 1222
New

We're in Beta

About us Mission Statement