justcoding121 / titanium-web-proxy

A cross-platform asynchronous HTTP(S) proxy server in C#.
MIT License
1.93k stars 618 forks source link

How to support http and http 2 at the same time? #929

Open zmpyzmpy opened 2 years ago

zmpyzmpy commented 2 years ago

https://github.com/justcoding121/titanium-web-proxy/blob/1e9d602af954b98074775f235b9581f62ce9e3b6/src/Titanium.Web.Proxy/ExplicitClientHandler.cs#L145

image

It seems that currently, it doesn't support both protocol at the same time, any workaround or any plan for supporting this?

trontronicent commented 2 years ago

The "simple" way.: Create a proxy (HTTP2 Enabled) that checks on connect, what the requested HTTP protocol version is, if the requested protocol is 1.1 Exact (meaning the client won't accept an upgrade to HTTP2), forward to a second proxy that has HTTP2Enabled on false (If i remember right, theres a func property for that - CustomUpstreamProxySelect or something like that.

Beside that, I would strongly suggest leaving HTTP2 off, because its restricting you still due to the implementation in this proxy API, due to not (yet) 100% implemented. What exactly are u trying to achieve? The only thing where the protocol change would affect you, is during decryption - you could use a HTTP1.1 conneciton in 99,999% of the target hosts, i barely met any host that did exclude 1.1, and 1.1 is still a standardized protocol, not being deprecated - and still lots of appliances etc. even new ones rely on it - and with HTTP3.0 still being not final and with a timespan of years to expect until it being also counting standard, theres no danger of 1.1 being deprecated anytime soon.

I assume, you're having a client application/appliance or some sort of office/corporate policy enforcing HTTP2? Or - the only other thing I can imagine, you're having issues trying to deal with ReCaptcha while decrypting? :P