grahlie
By:
grahlie

node/express ERR_CONNECTION_REFUSED on static files

October 8, 2015 3k views
DigitalOcean Node.js

Hi, new to digitalocean and deploying and all that stuff. But I get a very strange error when deploying my express application.

My droplet is a ubuntu with nodejs and the application is a standard express application generated through:
$ express myapp ...

so there is nothing fancy about the code but I get an error when trying to load in css and other static files using:
app.use(express.static(path.join(__dirname, 'public')));

and then i get ERRCONNECTIONREFUSED in the console for my files.

the strange part is that it´s all working on my local node server.

Does anyone have any suggestions or fix for this problem?

Cheers

3 comments
  • I'm not incredibly familiar with Node Express apps, but can you ping that Droplet on the expected port for that traffic? The error indicates to me that traffic is being blocked in some way by either a firewall, or some other rule.

  • BrookDO: cant ping that exact ip with the port I'm using for the express app. But by ping you mean this command in terminal?

    $ ping 1.1.1.1:3000
    

    I get a unknown host response from that.
    But with only the ip address and not the port it works fine.

  • I'm having this issue now. Did you manage to find a solution?

2 Answers

Hello! Did u solve your problem? Im having the same issue :(

How do you access the files?

What I've encountered is when I submit a form, that is pointed to just 'localhost', it seems to be blocked, so I accessed it relatively or 127.0.0.1.

Have another answer? Share your knowledge.