Laravel provides composer run dev to run a development server. This development server is run on localhost and therefore login sessions do not appear to work (CSRF token mismatch). Without excluding CSRF tokens entirely, what is the best approach to solve this issue?
- I attempted to add
localhostto theSESSION_DOMAINenv, but that did not appear to resolve it. Is there a value that solves this problem? - Is there a simple way to add a domain to the development server? I found some very brief documentation regarding
php artisan serve(which is responsible for running the server under the hood), however, when I do that, it seems Vite and all the other associated commands withcomposer run devseem to fail. Any documentation regarding this?
Very odd to me that Laravel provides a development server, but ultimately, it seems rather useless in most application (e.g. no sessions) due to CSRF token. I can spin up my own local server, but would prefer to have a working development server built in for future developers to leverage.