Fix fqdn detection when stripping prefixes from routes

A URL as a parameter (unescaped, so `://` shows) would cause too much of
the URL to be chopped, assuming the entire URL through the parameter was
a prefix to be maintained as the 'protocol and host' of the path.
Add test