1

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

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');
        }
    }
}
1
  • 私はPHPには詳しくないので詳しいことはわかりませんが、もしかしたらこちらの本家stack overflowの回答が参考になるかもしれません。 2022年11月18日 8:26

0

この質問に回答するには、ログインする必要があります。

のタグが付いた他の質問を参照する。