Only update cachedPath to lastRedirect in a redirect