NextJS CORS issue

Hello, I’m using NextJS 13 using the App Router and I’m using a beta version of Auth0.

Everything seemed to work just fine, however I noticed an issue when attempting to log out.
It shows a preflight CORS issue and right after that a requested which returned with code 404.
Apparently, this is the case for both the logout page as well as the authorize page.

The weird thing is, the issue only seems to happen when I use a <Link> component in NextJS. If I use a regular <a> tag, the logout script works just fine but I cannot use this in production.


So far I have tried adding custom headers to my next.config.js but it did not seem to resolve the issue. I’ve also tried changing CORS related settings in Auth0.

Would appreciate some help.

1 Like

It seems that after a while of being logged in, it does work but signing in and immediately after signing out causes the issue.

Still would like some help please…

1 Like

I’m having the exact same issue! Have you found any fix for this?

Turned out to be related to support of the new app router. The version I was using was in beta at the time, at full release the docs got updated. Apperently, you have to use basic anchor tags instead of the Link component for logging in and out if I recall correctly.

1 Like

This was the issue for me. Thank you!