Laravel5.2 will add web middleware to routing by default. How to disable it?
某草草
某草草 2017-05-16 16:52:38
0
4
926

Laravel5.2 will add Web middleware to routing by default. How to disable it?

web contains sessioncsrftoken. However, session and csrf are not used at all in the asynchronous notifications of Alipay and WeChat. How to disable.

I don’t want to touch the middleware configuration of verifycsrftoken.

某草草
某草草

reply all(4)
左手右手慢动作

Solved.

appHttpProvidersRouteServiceProvider.phpmapRoute 取消强制给加上的web中间件调用。自己在自己的路由中需要的时候增加 middleware=>web That’s it

仅有的幸福

Try not to modify itapp/Http/Kernel.php,极不推荐关闭CSRF。
修改app/Http/Middleware/VerifyCsrfToken.php to exclude the specified URL from CSRF verification.

<?php

    namespace App\Http\Middleware;

    use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;

    class VerifyCsrfToken extends BaseVerifier
    {
        /**
         * 指定从 CSRF 验证中排除的URL
         *
         * @var array
         */
        protected $except = [
            'testCsrf'
        ];
    }
迷茫

/app/Http/Kernel.php31AppHttpMiddlewareVerifyCsrfToken::class,Delete or comment

淡淡烟草味

It would be better if you take your routing out of the web middleware group.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!