middleware now ignores search and hash in URLs