Scrivito always calls your siteForUrl function with an absolute URL, i.e. including host, protocol etc. Similarly, your baseUrlForSite callback is expected to always return an absolute URL as well.
If siteForUrl is invoked with a URL that is not part of your application, your function must return undefined, to indicate to Scrivito, that this is an external URL.
In the example above, the callback returns a valid site ID for "mysite.net/de" and "mysite.net/en", but if invoked with "mysite.net/some_dummy_value" it would probably return undefined to signal to Scrivito that this URL does not denote a valid site. Scrivito treats this as “site not found”, meaning that it is not responsible for rendering this URL, i.e. both Scrivito.currentPage and Scrivito.currentSiteId will return null, and neither Scrivito.CurrentPage nor Scrivito.NotFoundErrorPage will render anything.