Static GitHub Issues

[434] Middleware not running when accessing page directly

prev: 0.10.0 increases `npm run dev` build time significantly
next: SSR debug

I have a login page with some middleware on it:

<template>
  <div>
    Hello login <nuxt-link to="/">Home Page</nuxt-link>
  </div>
</template>

<script>
  export default {
    middleware: 'authenticated'
  }
</script>

The middleware runs successfully when navigating to the login page through a nuxt-link. However if I go directly to the /login page, not through a nuxt-link, the middleware doesn't run. This bug invalidates the use of middleware, since it won't run if users access pages directly.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c378">#c378</a>)</em></sub></div>