1

I have a little Clojure app that uses http-kit to send some http post requests to a server. I want to route the https POST request through a proxy P, ie. I want the traffic to go like App->Proxy->Server.

(This is because the target host X restricts access based on IP)

Is this possible?

Also the App runs on an ubuntu server, are there maybe system-level configurations possible to make http-kit use a proxy server? I prefer other processes to be unaffected though.

Marten Sytema
  • 1,906
  • 3
  • 21
  • 29

2 Answers2

3

http-kit is supposed to follow the standard method of configuring proxies in Java:

-Dhttp.proxyHost=proxyhostURL \
-Dhttp.proxyPort=proxyPortNumber \
-Dhttp.proxyUser=someUserName \
-Dhttp.proxyPassword=somePassword

which you can set in your lein profile or in the application server if you are using one.

Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284
  • i added this to my project.clj :jvm-opts ["-Dhttp.proxyHost=someip" "-Dhttp.proxyPort=3128"] but it didn't work. is there a way to verify these settings are actually used? I run this from the repl, would that matter? – Marten Sytema Oct 20 '15 at 07:45
1

http-clj now support proxy: https://github.com/dakrone/clj-http#proxies

For http-kit, according to the author's reply in this issue, the answer is NO.

But the good news is fewer weeks before it support basic HTTP proxy ( commit a207537 on http-kit ).

After all, it seems there is no way to set up a system wide proxy for JVM applications.