WebSockets not being forwarded with custom domain


I’m using Glitch to host my project which heavily relies on the use of WebSockets. My server is an HTTP server, but it seems like glitch is running a HTTPS server which is proxying the requests to my server, effectively allowing my server to deal with HTTP requests while the client can still communicate via HTTPS and WSS respectively.

I have purchased a domain, and connected my project to this domain. I have moved my nameservers to Cloudflare (although I’m not quite sure this is still necessary) and enabled the Full SSL mode (“Encrypts end-to-end, using a self signed certificate on the server”). Now, I can reach my site via HTTPS and WSS using my glitch link (example.glitch.me), and all works well. From my custom domain (which is routed through Cloudflare), I can still reach my website via HTTPS, however I am unable to establish any WebSocket connection to the server. The requests just don’t complete.

I can see on the server side that I’m receiving socket connections in both cases, but the client seems unaware when using the application from my custom domain + Cloudflare website. How can I fix this? Is this a problem with Cloudflare? Does glitch even support WebSockets with custom domains?


This is an issue for support@glitch.com.
Just a note - Custom domains have given me odd results in the past.
Some PHP code did not execute on the custom domain.

1 Like

Same issue … I’ve just opened a ticket on glitch support.

My tests :
https://starter-guy.glitch.me/ : works like a charm
https://starter-guy.mlan.fr/ : can’t work (can’t establish the wss cnx)

Hi Emil!

Thanks for asking! Glitch does support websockets with custom domains.

However, we have received similar reports about new issues popping up when working with Cloudflare.

I haven’t been able to figure out why this is occurring (it used to work fine), so I have asked users who are affected to reach out to Cloudflare to see what advice they can provide. So far, I haven’t heard back from anyone.

If you choose to reach out to them, will you please let me know what they say? That way I can pass the info on to our developers to see if there is anything else we can do on our end.

In the meantime, I have heard from some users have been able to solve this by changing their Cloudflare SSL setting to “Flexible”.

Let me know if this helps.

Glitch Support

Thanks for quick reply …

But It can help me, because I don’t understand “what is cloudflare”.
(And how I could try to implement your solution)

Hey, I never found a solution. I just wanted you to know that I already reached out to glitch support a few months ago and they did not know how to fix it. Please let me know if they’ve figured it out if you decide to contact them yourself.