Thursday, 13 April 2017

Using NOIP with RPI node.js server

Im no expert in networks so sorry if something seems stupid.

I'm having a problem connecting to RPI node.js server located in my home externally. I used NO-IP and configured it on router with specific host-name. I have port forwarded to 8888 port.

var express = require("express");
var app = express();
var http = require("http").Server(app);
var io = require('socket.io')(http);
var path = require('path');
http.listen(8888, "0.0.0.0");

/*app.use(function (req, res, next){
    res.setHeader('Access-Control-Allow-Origin', 'http://hostname:port');
    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
    res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
    res.setHeader('Access-Control-Allow-Credentials', true);    
    next();
});*/
app.use(express.static(path.join(__dirname, '/')));
app.get("/home",function(req,res,next){
    res.sendFile(path.join(__dirname + "/index.html"));
});
console.log("server ubi jeza");

If I try to connect to http://hostanme.org it connect to my router. If I try connect to http://hostanme.org:8888 it times-off.

Port forward check works fine and says that port 8888 is working when I run the server. When server is not running it say that connection is closed.

I also tried with sudo nano /etc/sysctl.conf and net.ipv4.ip_forward=1 but it doesn't work ither.

Am I doing something wrong?



via AVoid

No comments:

Post a Comment