Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Accessing local services such as the web-based CUPS configuration (port 631) or Apache Tomcat (port 8080) with anything other than http://localhost:<port> fails. HOWEVER, doing the same with Apache httpd that came shipped with OS X works just fine. What's going on here? - fails

http://localhost:631/ - works - fails

http://localhost:8080/ - works - works!!!

http://localhost:80/ - works

I understand that 'localhost' uses the loop-back network interface while doesn't. So, in theory it's possible for the OS X firewall to interfere. However, the logs don't show dropped requests. Also, the behavior is exactly the same with the firewall turned off.

share|improve this question
up vote 2 down vote accepted

Yes, I wasn't aware that a port isn't necessarily bound to any address or any interface but to a specific address.


The CUPS config specifically binds to localhost by default. See config at /private/etc/cups/cupsd.conf:

# Only listen for connections from the local machine.
Listen localhost:631
Listen /private/var/run/cupsd 

If you enable printer sharing in Preferences -> Sharing CUPS will be available outside localhost, too.


I don't know yet which setting makes Tomcat bind to localhost only. However, for now I set up mod_jk to put Tomcat behind Apache.

share|improve this answer
Ok, Tomcat case solved, too... In server.xml there's an 'address' attribute for the HTTP <connector>. If you omit it or if you set it to Tomcat binds to all addresses associated with the server. ->… – Marcel Stör Sep 8 '10 at 20:42

A listening port can be bound to a specific interface address, or to any address.

Try the command: netstat -anp TCP

(It may be slightly different -- I'm not in front of a Mac right now. You want to display all listening TCP ports and their numerical addresses. )

You should see something like:

TCP ...

TCP ...

A port number preceded by means that it will accept a connection from anywhere. If preceded by, it means it will only accept a connection from the loopback interface.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .