title: Connect Device to Mac localhost Server?
body: <p>How do I allow any device, e.g., iPhone, to connect over a WLAN to my Mac's localhost server?</p>
  
  <p>On my Mac, I'm running a "Hello World" HTTP <a href="http://nodejs.org" rel="noreferrer">Node.js</a> server that serves a page, which Safari opens successfully, at <code>http://localhost:1337</code>. And, running <code>ipconfig getifaddr en1</code> in Terminal outputs <code>192.168.1.9</code>.</p>
  
  <p>But, Safari, on both iPhone &amp; Mac, displays "Safari can't connect to the server" when it tries to open <code>http://192.168.1.9:1337</code>.</p>
  
  <p>I don't think this should involve <a href="http://en.wikipedia.org/wiki/Port_forwarding" rel="noreferrer">port forwarding</a> because I only want the HTTP server to be available privately, not publicly.</p>
  
  <p>Related:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/5666018/accessing-localhost-from-iphone-in-same-network">Accessing localhost from iPhone (in same network)</a></li>
  <li><a href="https://superuser.com/questions/308451/connect-to-localhost-from-another-computer">https://superuser.com/questions/308451/connect-to-localhost-from-another-computer</a></li>
  <li><a href="https://superuser.com/questions/400752/can-we-run-local-server-over-local-network-without-internet-access">https://superuser.com/questions/400752/can-we-run-local-server-over-local-network-without-internet-access</a></li>
  <li><a href="https://serverfault.com/questions/254947/accessing-localhost-xampp-from-another-computer-over-lan-network-how-to">https://serverfault.com/questions/254947/accessing-localhost-xampp-from-another-computer-over-lan-network-how-to</a></li>
  </ul>