Node-RED-dashboard-template-node ERR_CONNECTION_REFUSED

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

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.

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

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?

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

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.

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

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

What else can I do here?

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.

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

But at least I found the following:

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?

Browser where? On computer or PI? What URL?

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

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

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?

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.

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

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