Reputation: 5237
I have created a node js server and I am not able to access it from outside the network.
var express = require('express');
var nodeapp = express();
var http = require('http');
var server = http.createServer(handleRequest);
function handleRequest(request, response){
console.log("Got some request" + request);
response.end("Response" + request.url);
}
server.listen(8086, "0.0.0.0", function() {
console.log("http server on ");
});
sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
My iptables don’t show anything. However I have a tomcat server which is on port 8080 and I am am able to access that.
Upvotes: 0
Views: 722
Reputation: 5817
If you're using base install of RedHat then you most likely have SELinux enabled.
Long story short about SELinux and it related to this question is that you can open and close ports for http access. Manipulating things like iptables is not necessary. Standard ports like 80 and 8080 are typically already open in the initial setup.
https://wiki.centos.org/HowTos/SELinux
refer to section 5.4
We may want a service such as Apache to be allowed to bind and listen for incoming connections on a non-standard port. By default, the SELinux policy will only allow services access to recognized ports associated with those services. If we wanted to allow Apache to listen on tcp port 81, we can add a rule to allow that using the 'semanage' command:
semanage port -a -t http_port_t -p tcp 81
A full list of ports that services are permitted access by SELinux can be obtained with:
semanage port -l
Upvotes: 1