Invalid State on proxied app

We have an app that’s currently being migrated to NextJs. A portion of our old pages are hosted on Amazon using S3 and CloudFront. The migrated pages are served by Vercel. We’re using CloudFront to do some path level routing, so while the domain is always www.wevolver.com the server changes depending on the route.

Our Auth0 configs are the same on both, however, when a user logs into the app on a page hosted by Vercel they end up on a callback page hosted on AWS.

This ends up resulting in an invalid state error.

Is there any way to resolve this. The state should exist under the same URL.

Any update on this we are facing same issue. We are using cloudfront distribution in front of our amplify application, and it causing us issues with invalid state, even doe the issue is not consistent