For request dispatch to microservices it is often useful to have a local reverse proxy acting as a smart, load balancing, connection-reusing client. This improves actual client language support by working around poor http clients as they are used only for local connections and keep-alive is less important. Clients can even skip TLS on local hop to the egress proxy in environments where policy allows it.
Given the above, it would be great if Caddy in proxy mode could convert regular HTTP, HTTPS and HTTP2 client connections over TCP to use QUIC as their transport to the backend.
Hi, thanks for your feature request!
We'd first need a pure Go QUIC client implementation, which there isn't one yet (quic-go may eventually have one). Also I'm not sure I can make this a priority in the near future. As such, I'm going to close this since there's nothing really to do on it for the time being. But thank you for your feedback!
Note: https://twitter.com/progrium/status/771021678524506112
This is the Go impl of QUIC that Caddy uses. But, it's server only. Can I sponsor somebody to contribute a client?
Appears that the client is now done: https://github.com/lucas-clemente/quic-go/pull/399 -> I'd love to get on this soon as a quic proxy would be a huge benefit for me. Any pointers on how I would go about doing this?
I have no idea... :confused: probably start in reverseproxy.go which is where Caddy initiates connections to backends.
Sounds good, I'll check it out and see if I can't figure out a plan.
Is anyone working on this? if no I would like to start.
@heri16 not that I know of, go for it! :+1:
Is there a certain style-guide I should follow when CONTRIBUTING?
The plan atttempt replacing http.Transport with h2quic.QuicRoundTripper .
https://github.com/lucas-clemente/quic-go/blob/master/example/client/main.go
Just run gofmt and golint before you commit. Anything else can be caught in code review in your PR before it gets merged.
See here if you haven't already https://github.com/mholt/caddy/blob/master/.github/CONTRIBUTING.md 馃槃
If I understand the request correctly the OP wants to connect to the backend service with QUIC. This sounds like a job for the additional protocol support which lets you register a round-tripper. Suggest this is continued as part of #1638.
@heri16: If you want to test it could work. Try adding these two lines. https://github.com/slightfoot/caddy-uwsgi/blob/master/uwsgi.go#L33-L34 but for your round-tripper with name "quic" and remove these lines https://github.com/mholt/caddy/blob/master/caddyhttp/proxy/upstream.go#L150-L153 You'll then be able to do the following in your Caddyfile.
proxy / quic://backendservice
Tried implementing it but could not get my branch to be stable. Sometimes the proxying work sometimes the request just hangs without a response. Since i see nothing wrong with the roundtripper, and i also tested using Caddy as the QUIC server, it might be protocol related. Not sure whether I want to Wireshark the QUIC protocol, so i am suspending work on this for now.
@heri16 Do you want to post what you have somewhere so others can take a look and build off of it?
Using RegisterProtocol("quic", &h2quic.QuicRoundTripper{}) does not work for me.
But I found something else!
@twdkeule Did you remove the conditional check here?
https://github.com/mholt/caddy/blob/master/caddyhttp/proxy/upstream.go#L152
Yes, I think so.
But it seems using http.Transport didn't work. However I used h2quic.Roundtripper directly and that worked (with some scheme changing). See #1782
@mholt Perhaps this is another issue. Doesn't QUIC force HTTP/2. which also users Trailers?
@slightfoot Yeah, QUIC is kind of a hybrid of TLS and HTTP/2 ... over UDP. Really strange, tbh. :smile: Trailers, I'm less sure about. I think, yes, but trailers are seldom used AFAIK.
health_check /index.html with quic backends does not seem to be working for me.
Here are my error logs:
14/Sep/2017:17:44:36 +0800 [ERROR 502 /] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:36 +0800 [ERROR 502 /favicon.ico] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:44 +0800 [ERROR 502 /] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:44 +0800 [ERROR 502 /favicon.ico] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:45 +0800 [ERROR 502 /] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:45 +0800 [ERROR 502 /favicon.ico] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:46 +0800 [ERROR 502 /] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:46 +0800 [ERROR 502 /favicon.ico] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:47 +0800 [ERROR 502 /] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:47 +0800 [ERROR 502 /favicon.ico] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:48 +0800 [ERROR 502 /] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:48 +0800 [ERROR 502 /favicon.ico] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:48 +0800 [ERROR 502 /] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:48 +0800 [ERROR 502 /favicon.ico] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:59 +0800 [ERROR 502 /] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:44:59 +0800 [ERROR 502 /favicon.ico] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:45:43 +0800 [ERROR 502 /] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:45:43 +0800 [ERROR 502 /favicon.ico] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:45:45 +0800 [ERROR 502 /] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:45:45 +0800 [ERROR 502 /favicon.ico] NetworkIdleTimeout: No recent network activity.
14/Sep/2017:17:48:42 +0800 [ERROR 502 /] HeadersStreamDataDecompressFailure: cannot read frame
I don't believe QUIC is supported for upstream health checks... but is a separate issue I think.
Most helpful comment
Sounds good, I'll check it out and see if I can't figure out a plan.