hackney
hackney copied to clipboard
Problems with proxy and {:error, :closed}
Hi Guys,
I caught weird behavior when I worked behind proxy.
Server 1 (behind proxy):
OS: Redhat.
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]
options = [proxy: "http://xxx", proxy_auth: {"login", "pwd"}, ssl: [versions: [:'tlsv1.2']]]
:hackney.get("https://google.com", [], [], options)
url = "https://media-direct.cdn.viber.com/download_photo?dlid=Gsag08bVZ_qFBt5G_ssCKUKFN9MJsAodr-kKgBVxln9MbHaKkeJe5WHjkqILcgzfeell1-pwccBnMH3aFJwtu4F0glyNO-53pUJ8vSWbUnNxW9qVy-xY1_HO7g7Dpl5bcUvbaA&fltp=jpg&imsz=0000"
:hackney.get(url, [], [], options)
When I fetch image behind proxy, I receive {:error, :closed}
Server 2 (without proxy):
OS Centos.
Erlang/OTP 20 [erts-9.1.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]
Make the same things and receive correct result.
I made the same things with HTTPoison. The similar response.
Could you help me to find solution or workaround for this issue?
Thanks!
I figured out issue.
Was two problems:
- old elixir and erlang packages
- proxy is not used when follow_redirect is true
yeah i should make sure we use the proxy on follow redirect. I will have a look tomorrow as it’s late herr already. Thanks for the report anyway!
yeah, thanks. It is related issue: https://github.com/benoitc/hackney/issues/273
How to enable proxy to follow redirects ?
@atanych , @benoitc can you help? I'm facing the same issue.