8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

LaravelでSet-Cookieの出力を止める

Posted at

JSON APIを作った時とか、Set-Cookieヘッダをレスポンスから消し去りたい場合は以下のようなフィルタを用意する。

Route::filter('session.cookie.remove', function(){
    Config::set('session.driver', 'array');
});

このフィルタを指定してあげればOK。

Route::group(
    [
        'before' => 'session.cookie.remove',
        'prefix' => 'v1'
    ]
    , function () {

    }
);

Ref: http://laravel.io/forum/03-28-2014-build-api-with-laravel-how-to-disable-cookie-output

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?