hackney icon indicating copy to clipboard operation
hackney copied to clipboard

Problems with proxy and {:error, :closed}

Open atanych opened this issue 6 years ago • 5 comments

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)

image

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)

image

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. image

I made the same things with HTTPoison. The similar response.

Could you help me to find solution or workaround for this issue?

Thanks!

atanych avatar Feb 07 '18 14:02 atanych

I figured out issue.

Was two problems:

  • old elixir and erlang packages
  • proxy is not used when follow_redirect is true

atanych avatar Feb 07 '18 21:02 atanych

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!

benoitc avatar Feb 07 '18 22:02 benoitc

yeah, thanks. It is related issue: https://github.com/benoitc/hackney/issues/273

atanych avatar Feb 07 '18 22:02 atanych

How to enable proxy to follow redirects ?

collegeimprovements avatar May 03 '18 11:05 collegeimprovements

@atanych , @benoitc can you help? I'm facing the same issue.

collegeimprovements avatar May 03 '18 11:05 collegeimprovements