# Websockets on node js server proxied with a cname record

**URL:** https://forum.infinityfree.com/t/websockets-on-node-js-server-proxied-with-a-cname-record/75796
**Category:** Hosting Support
**Created:** [May 7, 2023, 9:56am UTC](https://forum.infinityfree.com/t/websockets-on-node-js-server-proxied-with-a-cname-record/75796 "2023-05-07T09:56:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mawolol](https://forum.infinityfree.com/letter_avatar/mawolol/32/5_5575768a8748004e209b776fc1b2916d.png) [@mawolol](https://forum.infinityfree.com/u/mawolol)
#### Post date: [May 7, 2023, 9:56am UTC](https://forum.infinityfree.com/t/websockets-on-node-js-server-proxied-with-a-cname-record/75796/1 "2023-05-07T09:56:38Z")

</div>

I want to make a api with my node js server with is connected via a cname record to my domain.  
normal endpoints like get and post are working perfectly fine.

Now i want to add a websocket endpoint in my code.  
I use node js and tried fastify and express but with both libs i get error 504 (gateway timeout)

How can i fix this?

---

<div class="post-metadata">

### Author: ![KangJL](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/kangjl/32/12130_2.png) [@KangJL](https://forum.infinityfree.com/u/KangJL)
#### Post date: [May 7, 2023, 10:03am UTC](https://forum.infinityfree.com/t/websockets-on-node-js-server-proxied-with-a-cname-record/75796/2 "2023-05-07T10:03:54Z")

</div>

> [@mawolol](#):
>
> make a api

Likely impossible due to this

> [@Ensuring only web browsers can access your website](https://forum.infinityfree.com/t/ensuring-only-web-browsers-can-access-your-website/49353/):
>
> InfinityFree is a website hosting service. That means that the hosting accounts we provided are intended for hosting websites. Websites contain pages that are accessed through web browsers. InfinityFree is not intended to be used for file sharing, API hosting, database hosting or background tasks/tools. To help enforce this, free hosting enforces a security system that makes sure that anyone trying to access your website is using a normal web browser. This is done by checking whether the web br…

> [@mawolol](#):
>
> to add a websocket endpoint in my code

Unlikely to happen as well. Read below thread

> [@Websocket](https://forum.infinityfree.com/t/websocket/66601):
>
> is it possible to make a server with websocket in the free plan?

---

<div class="post-metadata">

### Author: ![mawolol](https://forum.infinityfree.com/letter_avatar/mawolol/32/5_5575768a8748004e209b776fc1b2916d.png) [@mawolol](https://forum.infinityfree.com/u/mawolol)
#### Post date: [May 7, 2023, 10:29am UTC](https://forum.infinityfree.com/t/websockets-on-node-js-server-proxied-with-a-cname-record/75796/3 "2023-05-07T10:29:15Z")

</div>

normal api requests are working though (post and get) cause i am using my own server (node js) and used a cname record to my domain and proxied it…

shouldnt websockets also work then?

---

<div class="post-metadata">

### Author: ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)
#### Post date: [May 8, 2023, 4:44pm UTC](https://forum.infinityfree.com/t/websockets-on-node-js-server-proxied-with-a-cname-record/75796/4 "2023-05-08T16:44:05Z")

</div>

> [@mawolol](#):
>
> and proxied it…

What do you mean with “proxied it”?

As I understand it, you have a site that’s hosted with us, and a subdomain of that site’s domain is pointing to a Node.js server hosted elsewhere. You’re trying to setup a websocket connection from somewhere (I assume it’s a browser, but it’s not clear to me where and how exactly).

If my understanding is correct, then there isn’t a lot we can do for you. We don’t host the websocket server and the client code doesn’t run on our servers, so our hosting doesn’t really matter in this issue. The only thing we could have any influence over is the CNAME record if you’re using our nameservers.

A Gateway Timeout error sounds like the proxy you’re using is unable to connect to the websocket server. But the reason for that could be anything, and nobody here is actually capable for checking anything for you.

If you want help from somewhere, I think your best place to start is to go through the support channels of the hosting provider that hosts your websocket server. The service that’s having problems is hosted with them, after all.

---

<div class="post-metadata">

### Author: ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)
#### Post date: [May 15, 2023, 4:44pm UTC](https://forum.infinityfree.com/t/websockets-on-node-js-server-proxied-with-a-cname-record/75796/5 "2023-05-15T16:44:54Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
