cannot externally connect to my Node.Js server? (DUPLICATE)

user2255757

server:

var http = require('http')
var fs = require('fs')

//404
function _404(response) {
    response.writeHead(404, {'Context-Type': 'text/plain'})
    response.write('error 404, not found')
    response.end()
}

http.createServer(onRequest).listen(8080)
console.log('server is running')

function onRequest(request, response) {
    if (request.method == 'GET' && request.url == '/') {
        response.writeHead(200, {'Context-Type': 'text/html'})
        fs.createReadStream('./testhtml.html').pipe(response)
    } else {
        _404(response)      
    }
}

works fine when i enter into my browser and call with localhost:8080, but am trying to connect to it with my phone (not on this network connection, but 4G) by entering my ip and port (XXX.XXX.XXX.XXX:8080)

Why is this not working, am i doing something wrong?

user2255757

Answer from another question [duplicate]:

Don't forgot to forward your port through router settings cause the router is receiving the requests not your PC

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Connect to dnsmasq server externally

From Dev

How to connect to an SSH server externally while protecting my IP address

From Dev

Node JS mongoose cannot connect to remote mongodb server

From Dev

Cannot connect to SQL Server with Node.js and Tedious

From Dev

Node JS mongoose cannot connect to remote mongodb server

From Dev

Reaching Node.js server externally from Google Compute Engine

From Dev

How to connect my mobile app (written in lua) and my server (written in node.js)?

From Dev

FireZilla Ftp server Cant Connect externally

From Dev

Cannot connect to Node.js server using socket.io + express + webpack, requests return 404 errors

From Dev

Connect to SQL Server with mssql for node.js

From Dev

Can't connect to a node js server in Android

From Dev

How to connect to a remote Node.js server?

From Dev

Can't connect to a node js server in Android

From Dev

node and express error "cannot GET /" even after I included app.get() in my server.js

From Dev

node server.js - Cannot GET /

From Dev

PhoneJS w Ripple simulator cannot connect to local node server

From Dev

Node-RED on Debian 9 server cannot connect to MQTT brokers

From Dev

Why cannot my boost http client connect to python http server?

From Dev

Retrofit cannot connect to my local web server on port 3000

From Dev

Cannot connect remotely to my email server using PHPMailer

From Dev

Cannot connect with SSH to my Ubuntu Server that is behind a router

From Dev

Cannot connect my RDS Oracle instance to a PHP server

From Dev

Get server's port from Node JS connect.js

From Dev

Cannot get node.js to connect to pubnub from corporate network

From Dev

One of my PCs in my local net cannot connect to my SSH server

From Dev

Cannot connect to PostgreSQL server

From Dev

Qt cannot connect to the server

From Dev

NullPointerError: Cannot Connect to Server

From Dev

cannot connect to DHCP server

Related Related

  1. 1

    Connect to dnsmasq server externally

  2. 2

    How to connect to an SSH server externally while protecting my IP address

  3. 3

    Node JS mongoose cannot connect to remote mongodb server

  4. 4

    Cannot connect to SQL Server with Node.js and Tedious

  5. 5

    Node JS mongoose cannot connect to remote mongodb server

  6. 6

    Reaching Node.js server externally from Google Compute Engine

  7. 7

    How to connect my mobile app (written in lua) and my server (written in node.js)?

  8. 8

    FireZilla Ftp server Cant Connect externally

  9. 9

    Cannot connect to Node.js server using socket.io + express + webpack, requests return 404 errors

  10. 10

    Connect to SQL Server with mssql for node.js

  11. 11

    Can't connect to a node js server in Android

  12. 12

    How to connect to a remote Node.js server?

  13. 13

    Can't connect to a node js server in Android

  14. 14

    node and express error "cannot GET /" even after I included app.get() in my server.js

  15. 15

    node server.js - Cannot GET /

  16. 16

    PhoneJS w Ripple simulator cannot connect to local node server

  17. 17

    Node-RED on Debian 9 server cannot connect to MQTT brokers

  18. 18

    Why cannot my boost http client connect to python http server?

  19. 19

    Retrofit cannot connect to my local web server on port 3000

  20. 20

    Cannot connect remotely to my email server using PHPMailer

  21. 21

    Cannot connect with SSH to my Ubuntu Server that is behind a router

  22. 22

    Cannot connect my RDS Oracle instance to a PHP server

  23. 23

    Get server's port from Node JS connect.js

  24. 24

    Cannot get node.js to connect to pubnub from corporate network

  25. 25

    One of my PCs in my local net cannot connect to my SSH server

  26. 26

    Cannot connect to PostgreSQL server

  27. 27

    Qt cannot connect to the server

  28. 28

    NullPointerError: Cannot Connect to Server

  29. 29

    cannot connect to DHCP server

HotTag

Archive