(Edit: I cleared this problem using HTTPoison get! Function.
HTTPoison.start HTTPoison.get!("httpbin.org/get", [], [{:proxy, {"proxy.mydomain.com", 8080}}])
I am new to using Elixir. I tried an example application on httpotion as a first step.
iex> response = HTTPotion.get "httpbin.org/get"
However, he could not get to the site for a proxy.
iex(1)> res = HTTPotion.get "httpbin.org/get" ** (HTTPotion.HTTPError) nxdomain (httpotion) lib/httpotion.ex:195: HTTPotion.handle_response/1
Without a proxy, it successfully works as follows:
iex(1)> res = HTTPotion.get "httpbin.org/get" %HTTPotion.Response{body: "{\n \"args\": {}, \n \"headers\": {\n \"Content-Length\": \"0\", \n \"Host\": \"httpbin.org\"\n }, \n \"origin\": \"191.238.84.51\", \n \"url\": \"http://httpbin.org/get\"\n}\n", headers: ["Access-Control-Allow-Credentials": "true",...
I tried to set proxy settings by reading ibrowse, which httpotion depends on, for example:
req = HTTPotion.get("httpbin.org/get", [{:proxy_host, "proxy.mydomain.com"}, {:proxy_port, 8080}])
But the result is the same.
How to set proxy settings for httpotion? Or is there an elixir replacement library for HTTP access that can handle proxies?
My environment is Ubuntu 14.04.2, and the environment variables (http_proxy, https_proxy, HTTP_PROXY, and HTTPS_PROXY) are set correctly.