Safari 7.0 cannot load localhost After upgrading to 10.9 and Safari 7.0, I can no longer load http://localhost:4000 in Safari. Yes, my site still loads perfect when I load it in Chrome and Firefox, so this is something new in Safari.

These are the error messages that I see in the developer window. The error message is

Failed to load resource: The network connection was lost.




It even looks like the server is doing its job correctly. Here's the output from the rake console. Everything is returning 200.

127.0.0.1 - - [24/Oct/2013 06:25:49] "GET / HTTP/1.1" 200 - 0.0039
127.0.0.1 - - [24/Oct/2013 06:25:49] "GET /stylesheets/screen.css HTTP/1.1" 200 - 0.0022
127.0.0.1 - - [24/Oct/2013 06:25:49] "GET /javascripts/modernizr-2.0.js HTTP/1.1" 200 - 0.0014
127.0.0.1 - - [24/Oct/2013 06:25:49] "GET /javascripts/octopress.js HTTP/1.1" 200 - 0.0018
127.0.0.1 - - [24/Oct/2013 06:25:49] "GET /javascripts/ender.js HTTP/1.1" 200 - 0.0048
I believe this is a problem with WEBrick v1.3.  WEBrick isn't returning the correct content length &amp; notifies users of this:


  WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Trying to wget the same resource will also flag an error in the network connection as per: https://github.com/imathis/octopress/issues/1395

Chrome &amp; Firefox just display whatever content was received &amp; don't worry about the mismatch in content length.  Safari, starting with Safari 7.0 on Mavericks' 10.9 is stricter about the response &amp; treats the mismatch as a "Failure to load resource" error.  (If I had to guess they're probably trying to improve the speed so don't retry the resource and so don't get the file fully retrieved response that wget does).

If you replace WEBrick with thin, this problem should go away.  To do this on a Rack-based application try:

echo gem \"thin\" &gt;&gt; Gemfile
bundle install
rbenv rehash # if you're using rbenv
bundle exec rackup -s thin