cloudflare / cloudflared

Cloudflare Tunnel client (formerly Argo Tunnel)
https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide
Apache License 2.0
8.83k stars 779 forks source link

HTTP2 protocol with SSE support doesn't seem to work for tunneling Concourse #262

Closed analytically closed 3 years ago

analytically commented 3 years ago

When adding protocol: http2 to the config file (supporting SSE) the tunnel to Concourse still fails to load build logs, so something must be off for SSE support.

chungthuang commented 3 years ago

Hi @analytically, the protocol is only available for named tunnels after release 2020.11.4. Checkout https://blog.cloudflare.com/argo-tunnels-that-live-forever/ for named tunnels are and https://developers.cloudflare.com/argo-tunnel/create-tunnel for how to set up a named tunnel.

analytically commented 3 years ago

Got it to work Initial protocol http2 but SSE still doesn't seem to be fully supported. I'm trying to tunnel Concourse (https://concourse-ci.org/) which uses SSE for the build logs but it doesn't come through.

chungthuang commented 3 years ago

I haven't used Concourse before. Do you know what response headers it returns? We expect SSE to include content-type: text/event-stream https://github.com/cloudflare/cloudflared/blob/master/origin/proxy.go#L230.

analytically commented 3 years ago

Yeah it's text/event-stream but it's suffixed with ; charset=utf-8

analytically commented 3 years ago

https://github.com/concourse/concourse/blob/2e467ac405b1f19c76f56b5e184b5b79e6af6418/atc/api/buildserver/eventhandler.go#L32

chungthuang commented 3 years ago

Thanks for pointing this out, we will fix it in the upcoming release.

analytically commented 3 years ago

Any idea when this would be? I can submit a simple PR if you'd like.

chungthuang commented 3 years ago

I have one in review by the team. It should be released by the end of the day.

chungthuang commented 3 years ago

Thank you for your patience. Digging further into the issue, we found our edge logic also needs to be updated, so I expect it to be ready tomorrow.

analytically commented 3 years ago

Using 2020.11.9 SSE still doesn't seem to be working as it should. Chrome now shows

Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR and it seems the events are not streamed.

analytically commented 3 years ago

199

chungthuang commented 3 years ago

Perhaps you tried before our edge logic rollout was completed. Can you give it another try?

analytically commented 3 years ago

I have just tried (restart of cloudflared), unfortunately same behaviour as before. Also see #199

analytically commented 3 years ago

The events are there but seem buffered.

abelinkinbio commented 3 years ago

We've released a few major enhancements namely the one documented here: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/private-net/create-tunnel

Check it out and let us know if this is a sufficient workaround.