Updates instance ID generation for both the ruby and nodejs servers
so that they avoid creating an already existing instance ID.
Fixed a bug with the nodejs server not handling HEAD requests
for files properly.

References #2767.