# Node-RED-dashboard-template-node ERR\_CONNECTION\_REFUSED

**URL:** <https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512>\
**Category:** Dashboard\
**Tags:** http-request, dashboard\
**Created:** [9 September 2022 09:43 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512 "2022-09-09T09:43:52Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![JustinB](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justinb/32/68068_2.png) [@JustinB](https://discourse.nodered.org/u/JustinB)\
**Post date:** [9 September 2022 09:43 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/1 "2022-09-09T09:43:52Z")

</div>

Hello,

I'm trying to connect xterm (which I implemented in dashboard-template-node) with wetty (to have a real terminal in the dashboard). But I'm always facing an error.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d4221401e0d851207b639893b28aa8aa931d2230.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/07afba7af4f197072a2508274e4a5e5bfa2c0d63.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 September 2022 10:00 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/2 "2022-09-09T10:00:46Z")

</div>

Where are you accessing the page from- same computer as node-red is installed it on another computer across the network?

I ask because you have hard coded the URL to localhost.

---

<div class="post-metadata">

**Author:** ![JustinB](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justinb/32/68068_2.png) [@JustinB](https://discourse.nodered.org/u/JustinB)\
**Post date:** [9 September 2022 10:05 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/3 "2022-09-09T10:05:58Z")

</div>

I want to access the terminal of the raspberry where node-RED is installed at. Currently I'm connected to the raspberry via ssh. I want to have the raspberry terminal accessable in the dashboard @ the windows-machine

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 September 2022 10:07 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/4 "2022-09-09T10:07:40Z")

</div>

The question was where are you seeing this error. On what Computer is the browser running? The raspberry pi or somewhere else across the network?

---

<div class="post-metadata">

**Author:** ![JustinB](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justinb/32/68068_2.png) [@JustinB](https://discourse.nodered.org/u/JustinB)\
**Post date:** [9 September 2022 10:10 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/5 "2022-09-09T10:10:57Z")

</div>

Ohh sorry, I missunderstood that. I'm getting the error at the windows-machine.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 September 2022 10:14 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/6 "2022-09-09T10:14:30Z")

</div>

Then your problem is using localhost in the URL. It is trying to connect to the windows computer on port 3001. That's why you getting error. That URL should be the IP of the PI since that's where you want the xterm to connect to.

Something you should understand. Is that anything running in the browser is client side. In other words, localhost means the computer where the browser is running, not where node red is running.

---

<div class="post-metadata">

**Author:** ![JustinB](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justinb/32/68068_2.png) [@JustinB](https://discourse.nodered.org/u/JustinB)\
**Post date:** [9 September 2022 10:49 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/7 "2022-09-09T10:49:19Z")

</div>

Good to know, thanks for that advice. I changed it now to the IP of the raspberry and now its throwing:

```auto
Access to XMLHttpRequest at 'http://10.207.48.36:3000/socket.io/?EIO=4&transport=polling&t=OCXsniT' from origin 'http://10.207.48.36:1880' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

```

I've already set the **httpNodeCors** in the settings.js but seems like its not applied to the dashboard-template-node.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/3/43a57cc74ddae395b4d60747f340449d3a79f91d.png)

What else can I do here?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 September 2022 11:08 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/8 "2022-09-09T11:08:25Z")

</div>

CORS is set by the endpoint server not the requester

In this case here, **you** are **requesting** from your browser to a **server** on the PI at port 3000.

In simple terms, the issue is not with node-red or dashboard or your flows - but with the endpoint serving the data - which is the application on the PI that serves port 3000.

Whatever that application on the PI is, you need to check its docs or repository for CORS settings.

---

<div class="post-metadata">

**Author:** ![JustinB](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justinb/32/68068_2.png) [@JustinB](https://discourse.nodered.org/u/JustinB)\
**Post date:** [9 September 2022 11:14 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/9 "2022-09-09T11:14:00Z")

</div>

Unfortunately there is not much to read in the docs of wetty.

But at least I found the following:

> **[Cors and Node-RED using a simple forwarding server](https://suedbroecker.net/2019/03/13/cors-and-node-red-using-a-simple-forward-server/)**
>
> When you use Node-RED on IBM Cloud during hackathons you will notice REST calls in flows cannot be directly invoked from a web application. The reason for this is mostly that cors (cross-origin res…

Do you think this workaround could do it?

Edit: I can access the terminal in my browser but node-red cant. So shouldnt the error come from node-RED?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 September 2022 11:27 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/10 "2022-09-09T11:27:10Z")

</div>

> [@JustinB](#):
>
> : I can access the terminal in my browser

Browser where? On computer or PI? What URL?

> [@JustinB](#):
>
> but node-red cant

Node red does not access the back end your browser does. And because you are TRYING to access something that is NOT belonging to the dashboard web server (served by node-red) you get a CORS error

---

<div class="post-metadata">

**Author:** ![JustinB](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justinb/32/68068_2.png) [@JustinB](https://discourse.nodered.org/u/JustinB)\
**Post date:** [9 September 2022 11:32 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/11 "2022-09-09T11:32:11Z")

</div>

The browser on my windows-pc. Connecting with 10.207.48.36:3000, like node-red does.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 September 2022 11:32 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/12 "2022-09-09T11:32:20Z")

</div>

If you read the wetty read me page it mentions running as an iframe. There is a launch command line flag to enable it.

What command do you use to launch Wetty?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 September 2022 11:33 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/13 "2022-09-09T11:33:38Z")

</div>

So the fact wetty access works by accessing its own URL is not a surprise since there is no cross origin resource. Another words you are accessing the resource directly. It works as it should.

When you try to access the wetty endpoint from within another web application served from a different endpoint, you get a CORS issue. Again this is to be expected since origins of resources are crossed.

The answer is the server (wetty) must be set up to permit cross origin resource access (CORS)

This issue has absolutely nothing to do with node red or dashboard.

---

<div class="post-metadata">

**Author:** ![JustinB](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justinb/32/68068_2.png) [@JustinB](https://discourse.nodered.org/u/JustinB)\
**Post date:** [9 September 2022 11:35 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/14 "2022-09-09T11:35:13Z")

</div>

Ohh I gonna try that out. Have to start it a bit strange:

> sudo npm start -- --port 3000 --base / --title wetty

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 October 2022 11:35 UTC](https://discourse.nodered.org/t/node-red-dashboard-template-node-err-connection-refused/67512/15 "2022-10-09T11:35:50Z")

</div>

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