Issue by jrudolph
_Wednesday Feb 11, 2015 at 13:48 GMT_
_Originally opened as https://github.com/akka/akka/issues/16853_
In spray, there's support for connecting to HTTP servers through an HTTP proxy (https://github.com/spray/spray/issues/102). This needs to be implemented for akka-http as well.
An important part of this is how to provide the configuration which requests to proxy and where to get the proxy configuration from. Spray allows configuration in the config file but also tries to pick up the well-known Java properties.
There's another ticket to enable proxying of https connections (#16153).
This is part of the bigger initiative to support a high-level HTTP client interface as tracked as #16856.
/cc @sirthias
Comment by RichardBradley
_Wednesday Sep 09, 2015 at 13:56 GMT_
(+1 from me. This can be very helpful in development, as it lets you pass Akka HTTP traffic through debugging proxies like Fiddler which is easier to play with than WireShark.)
Comment by jrudolph
_Tuesday Oct 20, 2015 at 09:01 GMT_
IIRC in February, we decided together to remove it from next.
Comment by sirthias
_Tuesday Oct 20, 2015 at 09:04 GMT_
Also important to remember: spray only supports non-encrypted client-side proxying, which is loosing importance quickly. So this ticket really should be tackled together with #16153.
Comment by rkuhn
_Tuesday Oct 20, 2015 at 09:42 GMT_
Ah, right. Now we have all the needed context on this ticket :-)
Comment by ktoso
_Tuesday Jan 05, 2016 at 13:51 GMT_
Another instance of need for it: :point_up: January 5, 2016 1:28 PM
Spray did have it so it's tricky to claim feature parity (for non-encrypted) hm...
Comment by weda
_Wednesday Feb 10, 2016 at 19:00 GMT_
Hi,
We try to make corporate world interested with akka http, but it really resides behind the proxy server. Is there a chance that this functionality will be released in next future .-)
Comment by AlexGilleran
_Thursday Aug 25, 2016 at 08:51 GMT_
Could the config for this be removed or at least the lack of the feature noted in the docs? (http://doc.akka.io/docs/akka/2.4.9/scala/http/configuration.html). Just spent a very confused half-hour trying to set up a proxy only to come to github and find it isn't implemented at all :(.
Comment by ktoso
_Thursday Aug 25, 2016 at 11:12 GMT_
Good point. Done.
Again, any help on getting this done is very welcome.
Comment by nemccarthy
_Thursday Sep 08, 2016 at 02:08 GMT_
+1 this is a real killer, we'd love to use it but without proxy support we are back to spray and even that doesnt support ssl :(
@ktoso proxy configuration values are still there: https://github.com/akka/akka-http/blob/master/akka-http-core/src/main/resources/reference.conf#L236 . Had me going for a while as well. Testing https://github.com/akka/alpakka/pull/24 may actually come to depend on the need to do proxying in akka-http...
What else would need to be done besides sending all traffic to the proxy IP instead of the real one, and always using HTTP/1/1 with a Host: header?
Duplicate of https://github.com/akka/akka-http/issues/89 . @jrudolph merge tickets?
The proxy setting is still there: https://github.com/akka/akka-http/blob/master/akka-http-core/src/main/resources/reference.conf
Please remove it as it. I causes confusion and I tasted too much time for debugging.
Thinking about PR'ing on this, but I have a hard time deciding what to do with maxConnections:
PoolFlow (?) in something to make it proxy-aware, so it can limit both max connections per proxy AND per hostI'm opting for (1), for simplicity's sake. Anyone else?
+1 for this. Our internal services were switched to proxy-only access, and I really hate to do any hacking or forking to make our client software work again.
Help in the ongoing PR is going to help get this delivered, +1's not really :-)
You're welcome to help with progress on it here:
This should be solved by https://github.com/akka/akka-http/issues/1213 and http://doc.akka.io/docs/akka-http/current/java/http/release-notes.html#10-0-10, right?
I'm not sure that covers all the aspects mentioned in this thread, such as honoring system properties such as http.proxyHost
@synox we now have https proxy support but not yet for generic http proxies and better configuration in general.
Hi. This is really showstopper for us. Because akka sets Host parameter in request and we cant override it so there is no way to emulate behavior of http_proxy on curl or python requests for example.
Hi @usagiy, you are very welcome to help out with a PR if you have time to provide it. For the looks of it, it's not one of the tasks that will be pick immediately by the core team.
For those interested, This roughly works for an http proxy. It falls on its face if the HttpRequest's scheme is not http
https://gist.github.com/adrianlyjak/a05da7b7d1e2c3d6989c45bb14965898
@usagiy - I was able to get past a problem with similar buzzwords - "proxy" is poorly defined - too many different meanings - I had to work through someone else's ajp 2.4 's client-side https proxy. My solution is way outside : http4s' client, driving the traffic through a java AsyncHttpClient. It does work pretty robustly for a few customers. Hope it helps. https://gist.github.com/dwalend/3f8439e882cd4430b0e266675b3fba94
Thanks guys, thanks @adrianlyjak I have basically reused your code and it works
seems this one has been sitting in a queue for a while. spent hours trying to workaround this. current solution for testing is proxy through a jetty proxy then going to hoverfly. ugly. :(
Most helpful comment
For those interested, This roughly works for an http proxy. It falls on its face if the
HttpRequest's scheme is not httphttps://gist.github.com/adrianlyjak/a05da7b7d1e2c3d6989c45bb14965898