drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.44k stars 1.1k forks source link

Unable to connect WebSocket through Cloudflare DNS #1802

Closed TheEnigmist closed 12 months ago

TheEnigmist commented 12 months ago

I don't know if there is a problem in CF settings or in drogon settings. I've HTTP and WS controller on my project, I can connect to WS controller only in localhost but not with my hostname. I can reach HTTP controller in localhost AND with hostname.

With hostname WS response is always error 404 not found.

I checked that CF WebSocket is enabled in Network settings. I wrote on CF community too cus I really don't know where to check for an error

albaropereyra22 commented 12 months ago

I suggest adding loging code to determine the route of your request. Note 404 is the default so you are probably just missing a handler or something simple like that.

TheEnigmist commented 12 months ago

I suggest adding loging code to determine the route of your request. Note 404 is the default so you are probably just missing a handler or something simple like that.

I thought the same, but if I use ws://localhost it works, as soon as I change to hostname it doesn't, so I think is something related to CF or something related to hostnames

albaropereyra22 commented 12 months ago

Have you considered making a small simple test using drogon server. What do your settings look like? Do you mind sharing maybe someone here is familiar with that.

TheEnigmist commented 12 months ago

Have you considered making a small simple test using drogon server. What do your settings look like? Do you mind sharing maybe someone here is familiar with that.

My bad, I'm so dumb, I forgot to add HTTP Upgrade & Connection Header in my reverse proxy, Now It works like localhost