# HTTPoison proxy option not working

**URL:** <https://forum.elixirforum.com/t/httpoison-proxy-option-not-working/49935>\
**Category:** Questions\
**Tags:** httpoison\
**Created:** [September 1, 2022, 4:42pm UTC](https://forum.elixirforum.com/t/httpoison-proxy-option-not-working/49935 "2022-09-01T16:42:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![orborn](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/o/9de053/32.png) [@orborn](https://forum.elixirforum.com/u/orborn)\
**Post date:** [September 1, 2022, 4:42pm UTC](https://forum.elixirforum.com/t/httpoison-proxy-option-not-working/49935/1 "2022-09-01T16:42:58Z")

</div>

I have this curl request

`curl -x "http://proxy-server.com:8001" -k "https://httpbin.org/ip"`

The curl request is going through the proxy server and I’m getting at each hit a new ip address (which is the expected behavior).

But when I try with HTTPoison it’s not working as expected.

I tried these codes

`HTTPoison.get!("https://www.httpbin.org/ip", [], [proxy: {"http://proxy-server.com"}])`

`HTTPoison.get!("https://www.httpbin.org/ip", [], [{:proxy, "http://proxy-server.com"}])`

What am I doing wrong ?

---

<div class="post-metadata">

**Author:** ![al2o3cr](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/al2o3cr/32/3457_2.png) [@al2o3cr](https://forum.elixirforum.com/u/al2o3cr)\
**Post date:** [September 1, 2022, 5:35pm UTC](https://forum.elixirforum.com/t/httpoison-proxy-option-not-working/49935/2 "2022-09-01T17:35:05Z")

</div>

> [@orborn](#):
>
> What am I doing wrong ?

The `proxy` option expects either a binary or a two-element tuple of `{host, port}`, so that first one is not going to work.

As for the second one, the URL doesn’t have a port specified like the one in the `curl ` command does. Maybe that’s the problem?

It would be useful to get more detail on “not working as expected” - what happens (error message, stack trace, etc) when you attempt those `HTTPoison` calls? I don’t have a proxy server handy to test with, so I can’t see what you’re seeing.

---

<div class="post-metadata">

**Author:** ![orborn](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/o/9de053/32.png) [@orborn](https://forum.elixirforum.com/u/orborn)\
**Post date:** [September 2, 2022, 11:09pm UTC](https://forum.elixirforum.com/t/httpoison-proxy-option-not-working/49935/3 "2022-09-02T23:09:15Z")

</div>

Thank you for your reply and the clear explanation.

I’ll try to tweak the code a bit more based on what you said.
