Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've run netstat -ano and netstat -lnp and neither outputs any process listening on Port 80.

I have a node.js app that is set to listen to port 8001, and I'm suppose to have Nginx proxy-forward certain requests to my node app.

I do see my node app listening on port 8001.

As far as I can tell, it's the node app that is serving all http requests, as I've stopped nginx.

I've also run iptables --list and nothing showed up.

So, how is it possible that my app running on port 8001, is serving requests in from port 80? Or rather, what other configuration stuff shoudl I be looking at?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

On the face of it what you are describing is not possible...

If lsof -i :80 says there is nothing listening on port 80 and iptables -t nat -L and iptables -t mangle -L say there are no iptables rules redirecting traffic from port 80 to port 8001 then there should be no way that an application listening on port 8001 can see requests on port 80.

So if you have ruled out all that you need to consider whether something outside the system, such as an external firewall, is rewriting the traffic.

The best way to find out would be to monitor the network traffic with tcpdump -i any port 80 or port 8001 and see what port the traffic seems to be appearing on.

share|improve this answer
1  
BOOM. Okay, so why does iptables --list not show the PREROUTING policy? I used iptables -t nat -L and it showed me the redirect that was happening. Next followup: How do I clear that out? –  Alan Nov 6 '12 at 22:35
1  
It's not showing it because by default iptables acts on the filter table and the PREROUTING chain is in the nat table, so you need to add -t nat to see it. –  TomH Nov 6 '12 at 22:39
    
Cool! i backed up my iptables then used -D PREROUTING 1 -t nat to baleete the rule. Thank so much, I was really scratching my head with this one! –  Alan Nov 6 '12 at 22:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.