Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I have a websocket program where I use nginx as a router. The problem is that websocket needs the Upgrade header to work properly. I'm sure my nginx config is correct and my program is working properly. (I tested with localhost). Details and proof? I leave it below. I hope a solution is found

Related config;

proxy_set_header Upgrade $http_x_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header UpgradeTest $http_upgrade+"_test"; #for be sure
proxy_set_header UpgradeXTest $http_x_upgrade+"_test"; #for be sure
proxy_set_header Connection "Upgrade"; #this is ok

Request;

curl -v 'https://mywebsocketserver.example/abc' -H 'Upgrade: websocket' -H 'Connection: Upgrade' -H "TestHeader: IAmHere"

Response (header) (go-map);

Testheader: IAmHere Accept: */* Accept-Encoding: gzip Cdn-Loop: cloudflare Cf-Connecting-Ip: <myip> Cf-Ray: 65a1b1ff3a30fd66-ATH Cf-Request-Id: 0a78ef738d0000fd66e76a8000000 Cf-Visitor: {"scheme":"https"} Connection: Upgrade Demote-Host: <myip> Upgradetest: +"_test" Upgradextest: +"_test" User-Agent: curl/7.76.0 X-Forwarded-Proto: https X-Real-Ip: <myip>

So, where is my Upgrade [$http_upgrade] header :)

I hacked my library and replaced Upgrade header with X-Upgrade. Now my app is working but i haven't found solution yet – raifpy Jun 4, 2021 at 17:23

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.