laravellaravel-fortifylaravel-breeze

Laravel 9 Breeze with fortify how disable default routes?


I use laravel only as a backend for a mobile application, for this I use Laravel Sanctum api. I don’t need everything that is displayed in the browser on the site, so I want to disable all unnecessary routes for web. Some of the routes are quite simply removed from the file app/config/fortify.php. But there are a few routes that I don't need, such as login, logout or _ignition/execute-solution. Where they are located and how to disable them is not clear.

List of routes that fortify added and that I would like to disable.

  POST       _ignition/execute-solution
  GET|HEAD   _ignition/health-check
  POST       _ignition/update-config
  GET|HEAD   livewire/livewire.js
  GET|HEAD   livewire/livewire.js.map 
  POST       livewire/message/{name}
  GET|HEAD   livewire/preview-file/{filename}
  POST       livewire/upload-file
  POST       login
  POST       logout
  POST       user/confirm-password
  GET|HEAD   user/confirmed-password-status
  GET|HEAD   user/profile

Solution

  • To disable Fortify routes in your Laravel application, you can utilize the Fortify::ignoreRoutes() method. This method allows you to remove all Fortify routes.

    Open FortifyServiceProvider.php and add this line Fortify::ignoreRoutes() to register method, your new code will look like this:

    public function register(): void
    {
        Fortify::ignoreRoutes();
    }