Closed KosyoK1104 closed 1 year ago
Indeed currently you can only specified routes to exclude from the redirection process. So you need to specify all the "public" routes in the exclude
option.
Indeed currently you can only specified routes to exclude from the redirection process. So you need to specify all the "public" routes in the
exclude
option.
I'm running onto something similar. Isn't there a hacky way to exclude all but include one single page? I have a very complex structure and I only need one /dashboard
page, seems a little bit hectic to have to add all of them.
I think the best way to handle this is to disable the redirect
option and do the redirection yourself in the concerned page with a simple middleware. If you disable the redirect
option, you'll need to configure the callback
url for auth as a client rendered route. You can check what this option set under the hood here and here. Hope it helps!
@davidparys , a dirty trick is to reverse engineer this regex here to behave like an include:
If you only need the /dashboard
path to be considered, you can use this pattern in nuxt.config
:
{
exclude: ['(?!*\/dashboard*)*']
}
I understand that this is has a low priority, but in my opinion this is a valid feature request. Don't you think @larbish?
I'd argue that this issue should be re-opened. My approach would be to add an optional include
property, basically doing the exact opposite of the exclude
property.
@jojomatik I agree. Feel free to create a PR, I'll be happy to merge it asap.
Here you go #336
Hello guys, I am trying to make sure the authentication check if the user is logged in to be applicable to only one folder and every other to be excluded from it. Should I use some regex if it is possible? Or should I write down every route that should be excluded?