Home

Issue: 3208

middleware on page-reload is not called on process.client

[issue link]

What problem does this feature solve?

I placed a middleware on a page like:

export default{
 middleware:['isAuth']
}

and this is the middleware code

export default function ({store, redirect}) {
  console.log(process.client) => never called on page-reload
  if (!store.getters.canEdit && process.client) {
    return redirect('/')
  }
}

This middleware works if I route to pages which are connected to the middleware. But if I do a page-reload on a page then the code is only getting executed on the server. Is this a bug or by design?

What does the proposed changes look like?

The middleware should execute always client and server side - either on page reload or routing.

This feature request is available on Nuxt.js community (#c6873)