When i open a Ruby http server locally, i. e. via http://localhost:4567
, it takes little time to load the page:
ruby -run -e httpd . -p4567
, directory listing — instantaneous;ruby -run -e httpd . -p4567
, a heavy jpeg — instantaneous;middleman server
, refreshing a previously opened website — ~5 seconds.
But when i do the same over LAN, it takes substantially longer to load the page. I tried it from two remote machines: a mobile phone over WiFi and a virtual machine running on the same host machine as the web server (using a virtual network adapter).
ruby -run -e httpd . -p4567
, directory listing — ~5 seconds;ruby -run -e httpd . -p4567
, a heavy jpeg — ~5 seconds to start downloading the image, then loads it almost instantaneously;middleman server
, refreshing a previously opened website — 15—30 seconds, may cause a timeout on mobile.
What can be the cause of this and how can it be resloved?
PS The host machine is Windows 7 but it seems to work both ways, i. e. when the server runs on a Linux virtual machine.