blaze
blaze copied to clipboard
blaze-client doesn't support proxy settings
On behalf of Bryce Anderson, moving issue with http proxy to http4s repo
Original issue: http4s/blaze#14
I'm not practiced in the art of http proxy, so if any of the below procedure is wrong, let me know. I've never implemented it, just done a little reading (prompted by your issue).
We need to add the ability to configure a proxy here and here. Next, we need the clients (pooled and simple) to know to rewrite the request line to include the whole url. This will need to be done in Http1ClientStage. That means it also needs to know about the proxy (if there is one). It gets initialized from Http1Support which means you must pass the proxy config down the line. Could you also please link some appropriate RFC's/whatever else you find relevant in the issue?
I haven't though much about how https will effect all of this, and probably should read about it. At any rate, do you want to close this issue, open an appropriate one in http4s/http4s? Please copy the discourse above and reference this issue when you do. I'm happy to help guide you through the process, but know I'm not an expert in proxy so I hope to learn something in the process as well.
As far as I checked the code of https://github.com/AsyncHttpClient/async-http-client in case of http protocol following things needs to be done:
- rewrite request line (to include original full address of http endpoint)
- rewrite/add authentication header if proxy requires this
In case of https protocol is actually more tricky, because http client needs to do more work:
- first it needs to issue HTTP CONNECT to proxy and then proceed with the request (plus above things), it's probably due to ssl termination issues
I will try to find some RFC to be sure how the protocol look like, in case of http proxy since its also my first time to implement one.
:+1:
I just got bitten by this. I naively thought that adding -Dhttp.proxyHost=
would magically make things work ..
Have you started any implementation of this somewhere?
Sorry didn't have time to work on this
We've gotten a couple requests about this recently. Putting this on the map for 0.16.
May I ask the status of this issue at the moment? Is pull request http4s/http4s#1182 heading down the right path? It looks like a lot of work was done on it!
I think it mostly was on the right path, and I still want to see this finished. We just had other priorities. I'd be happy to support someone if they want to pick this up and run with it.
Is there any way known workaround?
@stefanobaghino async-http-client supports proxies, and http4s-async-http-client has the same interface as http4s-blaze-client.
@rossabaker Thanks for the help!
We still need this for blaze. In the meantime, @dwalend has a gist for async-http-client.
Hi, I switched to AsyncHttpClient and the proxy is working.
@dwalend Thanks.
I still think it should be an issue on Blaze also, even if the builder is changed on http4s side the BlazeClient doesn't support something so simple like a proxy.
Due to a bug at the netty/asynch-http-client boundary that showed up under load, we switched to https://jdk-http-client.http4s.org/stable/ to get the full proxy features. It's not as nice as having it in ember, but no instability problems.