nodejs express weird behavior question?

55 views
Skip to first unread message

Uomo di Carbone

unread,
Jul 28, 2015, 9:16:40 AM7/28/15
to nodejs
I set up nodejs with express on my raspberry pi (Rpi) and pointed to this domain: http://111001.cc:3000/
I set ip tables to forward port 3000 to 80 as follows:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000

I've got a couple of weird things happening.
First of all I can not access the port 80 instance of http://111001.cc locally on my pi but I can on another host.
Why?

Second. When I look at the access logs I am GET hits to another server I had pointed to 111001.cc
GET /downloads/moodledata/8/moddata/assignment/144/317/ 404 73.693 ms - 965

Why?

Thanks
1885 cwc

Ryan Schmidt

unread,
Jul 29, 2015, 9:03:31 AM7/29/15
to nod...@googlegroups.com

On Jul 28, 2015, at 8:02 AM, Uomo di Carbone wrote:

> I set up nodejs with express on my raspberry pi (Rpi) and pointed to this domain: http://111001.cc:3000/

I'm not sure what you mean here by "pointed to this domain: http://111001.cc:3000/". I'm assuming you mean that the raspberry pi has the public IP address that 111001.cc resolves to, and that your node app is listening on port 3000?

> I set ip tables to forward port 3000 to 80 as follows:
> iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000
>
> I've got a couple of weird things happening.
> First of all I can not access the port 80 instance of http://111001.cc locally on my pi but I can on another host.
> Why?

That sounds like an iptables question (which I can't answer)


> Second. When I look at the access logs I am GET hits to another server I had pointed to 111001.cc
> GET /downloads/moodledata/8/moddata/assignment/144/317/ 404 73.693 ms - 965
>
> Why?

I'm not sure what you mean by "another server I had pointed to 111001.cc". If you mean that you have another domain name that is set up as a CNAME to 111001.cc, or another domain name with an A record pointing to the same IP address that 111001.cc points to, then if your node app is listening on that IP address and a particular port, then any requests coming in to that IP address and port, regardless of if a domain or host name is used or what that domain or host ame is, the node app will respond to those requests.

chedder

unread,
Jul 29, 2015, 11:54:01 AM7/29/15
to nod...@googlegroups.com

It's because the IPTables rule is pointing to eth0 which binds to your internet IP.  The localhost is bound to a loopback device (usually lo0 instead of eth0).


--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/774223FE-0540-4F6D-BC45-8886186AB655%40ryandesign.com.
For more options, visit https://groups.google.com/d/optout.

Uomo di Carbone

unread,
Aug 28, 2015, 10:41:33 PM8/28/15
to nodejs
I got things to work by changing the port in the www file to port 80.
thanks or the help:
http://111001.cc
Reply all
Reply to author
Forward
0 new messages