-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nuxt-auth-utils throws Unauthorized (/api/_auth/session)
on any 404 page
#115
Comments
Is your site prerendered or SSR disabled? |
No it's the default Nuxt start app deployed on cloudflare pages.
|
Hi @cosbgn This is tricky as the error page can have a header and display the user state. Any unauthenticated call to any pages (200 or 404) will lead to a 401 for the You may want to only keep the 500 errors for Sentry don't you think? |
If I'm using In my opinion a 401 should be thrown only if I'm trying to access a protected page, not when I'm looking at the homepage. I do use this in my sentry plugin, so it's not a big issue: if (context?.event?.path === "/api/_auth/session"){
return; // Skip because we get a ton of unauthorized without reason
} Anyways, If this is by design, and it's the only way to get it working I'm happy to close this. |
I tend to agree with you, the Will make a PR to avoid returning a 401 of this API call. |
Yes, ideally |
Can you try with the |
Seems to work, I'll comment here if I spot some issue, but for now looks perfect. Thanks a lot! |
I added sentry to my project and within days I had hundreds and hundreds of
Unauthorized
errors coming up.After investigating I arrived to the conclusion that:
So since bots scan for /wp-admin etc I get a ton of these.
This is a small reproduction (create a nitro plugin):
Open any 404 page like
/api/does-not-exists
or even client pages like/does-not-exists
The console will show:
Not sure why this is happening but it doesn't seem like a normal behavior.
The text was updated successfully, but these errors were encountered: