Skip to content

Nova RedirectIfAuthenticated ('nova.guest') middleware does not automatically apply custom guards #6836

Closed
@jmsfwk

Description

@jmsfwk
  • Laravel Version: 11.44.1
  • Nova Version: 5.4.3 (Silver Surfer)
  • PHP Version: 8.4.6
  • Database Driver & Version: N/A
  • Operating System and Version: N/A but macOS 15.4
  • Browser type and version: N/A but Firefox 139
  • Reproduction Repository: N/A

Description:

The Nova Authenticate middleware will fetch the customised Nova guard from the config before running its checks.

$guard = config('nova.guard');
    
// ...
    
return parent::handle($request, $next, ...$guards);

The Nova RedirectIfAuthenticated does not do this, which leads to a loop, e.g. /nova -> /nova/login -> /nova -> ...

Detailed steps to reproduce the issue on a fresh Nova installation:

  1. Set up an additional authentication guard using a copy of web, so you have web then the new guard nova
  2. Set NOVA_GUARD=nova in .env
  3. Set the Nova login route to use the nova.guest middleware
  4. Try to access /nova and you should see the loop

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified bug by the Nova teamfix incomingA fix is in review

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions