When determining whether we're a local file request, see if we have a valid host before using the window's location.

Before checking whether the request is local, we should first check to see if the original request had a host before assuming that we need to use the window's host.