@ahoi This isn’t new behaviour. If you send requests with a Accept: application/json header then you will get JSON responses, rather than HTML/redirect responses.
Jun 15, 2024
4
Level 5
Prevent redirection in Laravel 11 (API-only project)
Laravel 11 came with some kind of new project structure. And now I am facing a problem, which was never a problem to solve for me before:
I don't want to redirect a user to /login if the user is not authenticated. In such a szenario, I am getting:
Route [login] not defined
which originates from
vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php:118
What is the correct way to deal with it now?
Please or to participate in this conversation.