Handle invalid URIs and long referrers.