http4s / blaze

Blazing fast NIO microframework and Http Parser
Apache License 2.0
350 stars 63 forks source link

blaze-client doesn't support proxy settings #656

Open elyast opened 9 years ago

elyast commented 9 years ago

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.

elyast commented 9 years ago

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:

In case of https protocol is actually more tricky, because http client needs to do more work:

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.

suls commented 9 years ago

:+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?

elyast commented 9 years ago

Sorry didn't have time to work on this

rossabaker commented 7 years ago

We've gotten a couple requests about this recently. Putting this on the map for 0.16.

cjwebb commented 6 years ago

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!

rossabaker commented 6 years ago

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.

stefanobaghino commented 6 years ago

Is there any way known workaround?

rossabaker commented 6 years ago

@stefanobaghino async-http-client supports proxies, and http4s-async-http-client has the same interface as http4s-blaze-client.

stefanobaghino commented 6 years ago

@rossabaker Thanks for the help!

rossabaker commented 6 years ago

We still need this for blaze. In the meantime, @dwalend has a gist for async-http-client.

vjroby commented 5 years ago

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.

dwalend commented 3 years ago

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.