ゲストが認証せずに会員登録済み画面に遷移しようとした際にホームにリダイレクトするという処理を行った際にでたエラーです。この解決方法を知りたいです。お願いします。

```

    Header may not contain more than a single header, new line detected
    
```

web.php

```

    Route::group(['middleware' => ['guest']], function () {
        // google認証
        Route::get('/auth/redirect', [AuthController::class, 'redirectToGoogle']);
    
        Route::get('/callback/google', [AuthController::class, 'handleGoogleCallback']);
    
        Route::get('/guest/{any?}/{param?}', function () {
            return view('web.guest');
        })->where('all', '.*')->name('guest');
    });
    
```

Authenticate.php

```

    class Authenticate extends Middleware
    {
        /**
         * Get the path the user should be redirected to when they are not authenticated.
         *
         * @param  \Illuminate\Http\Request  $request
         * @return string|null
         */
        protected function redirectTo($request)
        {
            if (!$request->expectsJson()) {
                return redirect('/guest/home');
            }
        }
    }
    
```
CC BY-SA 4.0
2022-11-18T01:22:11.447
92289
2022-11-18T01:22:11.447
55000
question
php laravel
laravel9 middlewareのエラー