AWS Ubuntu 13.04 and Websockets - node.js

I have launched an instance (Ubuntu Server 13.04 - ami-c30360aa (64-bit)) and I cannot get websockets working over port 80.
They work on other ports, such as 50000 or whatever I want -- however on port 80 I always receive:
"' failed: Unexpected response code: 400 "
Does anybody have any solutions? I had them working on port 80 via Linux AMI on AWS, and on an older version of Ubuntu.

Related

Cannot access to WSL2 port opened via IPv6 from Windows host

I have a node-server running at WSL2 Ubuntu-20.04.
netstat -tulpn in WSL shows the following ports:
The ports specified as 0.0.0.0:8080 can be accessed in both WSL and Windows via 127.0.0.1:8080 url
My issue is that the ports specified as :::3006 can be accessed via 127.0.0.1:3006 only inside WSL, but from Windows, it works only via the network URL like http://172.28.100.200:3006.
When I send the request to 127.0.0.1:3006 from Windows, there is no connection error, but the server inside WSL does not receive it while using the network address, it does.
How can I investigate this and make the Windows port at 127.0.0.1:3006 forward requests into the same port in WSL?
UPDATE:
So I solved this by adding a port proxy, but again, WSL network IP is needed for this to work:
Any chance to avoid using network IP?

Run NodeJs on port 80

I am trying to host my app on port 80. I know that it is a root port. I tried running my app with sudo, but no luck. P.S I am using Linux 16.04 LTS server. Thx!

Unable to connect to cloud9 over LAN

I've installed cloud 9 Ubuntu 14.04 (Desktop), and executed it by typing:
node [cloud9folder]/server.js -p 8080 -a :
I was able to connect to it by typing localhost:8080 (On the same computer that is running cloud 9) but when I went on another computer on the same network, I was unable to connect by typing [ip address of the computer running cloud9]:8080 into the browser. The browser returned: "Webpage not available (ERR_CONNECTION_REFUSED)."
I know the server computer is working, I was able to access it's apache2 website but for some reason it is unable to connect to cloud 9.
How do I fix this?
also add -l 0.0.0.0 by default server is listening on 127.0.0.1 which is not public

"Error: bind EAFNOSUPPORT" when trying to use udp6

I have a script running smoothly on one server
// create a new UDP server
dgram = require('dgram');
server = dgram.createSocket('udp6');
server.bind(20500,config.server.ip);
on the second server executing the code throws an error: "Error: bind EAFNOSUPPORT"
node version is v0.10.26 on both machines, however the one where it is working is Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-56-virtual x86_64) and the one where it is not working is Ubuntu 12.04.4 LTS (GNU/Linux 2.6.32-312-ec2 x86_64)
so the Kernel versions are quite different. What could possible be a fix to for this error?
I solved this issue by changing to
server = dgram.createSocket('udp4');
and setting my server ip to 0.0.0.0
I was not able to make udp6 work

Specify host parameter for Node.js on Amazon EC2

Most of my node apps I have been able to start like this:
server.listen(8080);
Now I am working with a phantomJS script which requires you to pass the host and port when starting the server. I have not been able to even get a simple hello world to work. I have tried to get the host value several different ways:
from a app.js file
var hostname = require(‘os’).hostname().split(‘.’).shift();
from commandline
uname -n
hostname
And starting the server like this:
server.listen(8080,"127.0.0.1");
server.listen(8080,"localhost");
...etc
And the server starts w/o errors, but never responds to http requests. When I remove the host parameter it works fine.
node -v
v0.10.10
Distributor ID: Ubuntu
Description: Ubuntu 10.04.4 LTS
Release: 10.04
Codename: lucid
running in an ec2 instance
Any thoughts?
I'm not sure why this works as the host
0.0.0.0
If someone can shed some light I'll be sure to mark as answered, thanks for reading.

Resources