Removing the middleware and having a dedicated endpoint (either as an API call, followed by a page refresh, or as a place to send the browser and pass a "next" param to bring us back to the page being viewed) would be good for performance (and request processing complexity) overall. If you have something that basically works (in practice, even if occasionally failing in tests) for now, let's go with that, but could you open an issue so we can revisit this for a future release?