Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
297 views
in Technique[技术] by (71.8m points)

javascript - Cloudflare Nodejs HTTP Connection upgrade to Websocket

I’m a NodeJS developer and I have some problems listening to the “upgrade” event on my origin web server since the Connection “upgrade” header is not supported by HTTP/2 and HTTP/3 but only by HTTP/1.1

After some research and tests, I noticed that Browser/Client <—> Cloudflare requests are served using HTTP/2 since Cloudflare and the Browser automatically negotiate the highest protocol available.

So even if Cloudflare forwards requests using HTTP/1.1 and my webserver tries to upgrade it, the upgrade will never receive an OK from the Client since there’s a conflict between HTTP versions.

I’d like to know if there’s a way to downgrade or specify the version to use for the Client <—> Cloudflare connection.

I use HTTP, HTTPS,http-proxy, cors, socket.io, and express.

If you need the code comment and I will post it.

P.S.: I might be 100% wrong.

question from:https://stackoverflow.com/questions/66050781/cloudflare-nodejs-http-connection-upgrade-to-websocket

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...