Home

Issue: 3002

Redirect absolute url in middleware

[issue link]

I’m having a problem when redirecting to an absolute URL inside a middleware, it return to a page with ERR_REDIRECT and then go to the desired page.

Nuxt mode: spa

auth.js middleware:

export default function (context) {
  const token = window.localStorage.getItem('token')
  if (!token) {
    context.redirect('https://nuxtjs.org/')
  }
}

Video showing the page:
middleware nuxt

This question is available on Nuxt.js community (#c2601)