Changes after code review:

- fixed url handling when removing protocol or server part:
    - only removes protocol and hostname from the beginning of the URL
    - handles protocol relative URLS
      (previously an URL like "//foo/foo" would have been converted to "///foo")

- fixed module name in error message

- removed dead code and commented-out debug logging