httpoison icon indicating copy to clipboard operation
httpoison copied to clipboard

checkout_failure when using httpoison with proxy

Open mjaow opened this issue 2 years ago • 3 comments

traffic went through proxy , and failed with error checkout_failure. Does anyone know this issue?

httpoison version 1.8 and hackney version 1.17.4. with default options + proxy setting + cacert setting for httpoison

mjaow avatar Nov 11 '21 15:11 mjaow

Also experiencing this issue

CJPoll avatar Dec 12 '21 22:12 CJPoll

So there were a few things I had to do to fix it:

  1. Make sure to set the hackney options for using a socks5 proxy
  2. Not directly related to the proxy issue, but I had to change my proxy URL from a binary (Elixir String) to a charlist.

I set the hackney options by implementing process_request_options, which receives any connection options passed to the request and transforms them in whatever way you want. In my case, this did the trick:

# host needs to be a charlist, not a binary/string
options
|> Keyword.put(:proxy, {:socks5, host, port})

CJPoll avatar Dec 12 '21 23:12 CJPoll

@edgurgel I think this issue can be closed because @CJPoll found the reason.

Hentioe avatar Jun 08 '22 07:06 Hentioe