Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for HTTP proxy servers on the client side #115

Open
akka-ci opened this issue Sep 8, 2016 · 26 comments
Open

Add support for HTTP proxy servers on the client side #115

akka-ci opened this issue Sep 8, 2016 · 26 comments
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted play-akka-http-integration t:client Issues related to the HTTP Client
Milestone

Comments

@akka-ci
Copy link

akka-ci commented Sep 8, 2016

Issue by jrudolph
Wednesday Feb 11, 2015 at 13:48 GMT
Originally opened as akka/akka#16853


In spray, there's support for connecting to HTTP servers through an HTTP proxy (spray/spray#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

@akka-ci akka-ci added this to the http-backlog milestone Sep 8, 2016
@akka-ci akka-ci added 2 - pick next Used to mark issues which are next up in the queue to be worked on. The tag is non-binding t:http labels Sep 8, 2016
@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

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.)

@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

Comment by tjdett
Friday Oct 09, 2015 at 05:40 GMT


👍. I wondered why, while porting my app from Spray to Akka-HTTP, my Betamax tests stopped working.

Respecting system properties http.proxyHost et al is rather important.

@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

Comment by rkuhn
Tuesday Oct 20, 2015 at 08:44 GMT


What’s the status here, if this was in Spray then it should be in http:next, no?

@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

Comment by jrudolph
Tuesday Oct 20, 2015 at 09:01 GMT


IIRC in February, we decided together to remove it from next.

@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

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.

@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

Comment by rkuhn
Tuesday Oct 20, 2015 at 09:42 GMT


Ah, right. Now we have all the needed context on this ticket :-)

@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

Comment by ktoso
Tuesday Jan 05, 2016 at 13:51 GMT


Another instance of need for it: ☝️ January 5, 2016 1:28 PM

Spray did have it so it's tricky to claim feature parity (for non-encrypted) hm...

@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

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 .-)

@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

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 :(.

@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

Comment by ktoso
Thursday Aug 25, 2016 at 11:12 GMT


Good point. Done.

Again, any help on getting this done is very welcome.

@akka-ci
Copy link
Author

akka-ci commented Sep 8, 2016

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 ktoso added 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted and removed 2 - pick next Used to mark issues which are next up in the queue to be worked on. The tag is non-binding t:http labels Sep 8, 2016
@jrudolph jrudolph added t:client Issues related to the HTTP Client and removed t:client Issues related to the HTTP Client t:http:client labels Nov 2, 2016
@jypma
Copy link
Member

jypma commented Nov 8, 2016

@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 akka/alpakka#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?

@jypma
Copy link
Member

jypma commented Nov 9, 2016

Duplicate of #89 . @jrudolph merge tickets?

@synox
Copy link
Contributor

synox commented Nov 14, 2016

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.

#89 is not a duplicate, as it for server side, not for client side.

@jypma
Copy link
Member

jypma commented Nov 24, 2016

Thinking about PR'ing on this, but I have a hard time deciding what to do with maxConnections:

  1. We could apply it per target host, as it is now, simply routing them all through the same proxy if settings say so. This would then only indirectly limit the max connections per proxy
  2. We could apply it to the proxy, by routing all proxied requests for the same proxy to the same shared pool gateway. This would directly limit connections per proxy, but we'd lose ability to limit per target host.
  3. Somehow wrap PoolFlow (?) in something to make it proxy-aware, so it can limit both max connections per proxy AND per host

I'm opting for (1), for simplicity's sake. Anyone else?

@michkhol
Copy link

michkhol commented Mar 7, 2017

+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.

@ktoso
Copy link
Member

ktoso commented Mar 7, 2017

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:

@synox
Copy link
Contributor

synox commented Sep 5, 2017

@raboof
Copy link
Member

raboof commented Sep 5, 2017

I'm not sure that covers all the aspects mentioned in this thread, such as honoring system properties such as http.proxyHost

@jrudolph
Copy link
Member

jrudolph commented Sep 5, 2017

@synox we now have https proxy support but not yet for generic http proxies and better configuration in general.

@usagiy
Copy link

usagiy commented Jul 2, 2018

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.

@jlprat
Copy link
Member

jlprat commented Jul 2, 2018

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.

@adrianlyjak
Copy link

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

@dwalend
Copy link

dwalend commented Jul 2, 2018

@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

@usagiy
Copy link

usagiy commented Jul 3, 2018

Thanks guys, thanks @adrianlyjak I have basically reused your code and it works

@pete-proton
Copy link

pete-proton commented Dec 8, 2019

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. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted play-akka-http-integration t:client Issues related to the HTTP Client
Projects
None yet
Development

No branches or pull requests