niclas-timm / laravel-nextjs-starter

A Starter Kit for applications with Laravel as the API and NextJS for the Frontend
308 stars 82 forks source link

Error on deploy #32

Closed YnievesDotNet closed 3 years ago

YnievesDotNet commented 3 years ago

Thanks for this project, is amazing.

now i have receive error with csrf...

this set-cookie was blocked because its domain was invalid with regards to de current host url

and when I try login receive that error

CSRF token mismatch.

I has a nextjs url with proxy under the url https://front.domain.me, and the api in https://api.domain.me

I has configured in the .env:

SESSION_DOMAIN=front.domain.me
SANCTUM_STATEFUL_DOMAINS=front.domain.me

and in the client\.env.local that:

NEXT_PUBLIC_API_HOST_URL=https://api.domain.me

Thanks

Yoinier.

YnievesDotNet commented 3 years ago

I has configured in the .env:

SESSION_DOMAIN=.domain.me
SANCTUM_STATEFUL_DOMAINS=.domain.me

and now work

niclas-timm commented 3 years ago

Hi there,

Happy to hear you like the project and were able to find a solution.