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.
ringa_lee2017-05-16 16:54:38
Solved.
appHttpProvidersRouteServiceProvider.php
中 mapRoute
取消强制给加上的web中间件调用。自己在自己的路由中需要的时候增加 middleware=>web
That’s it
仅有的幸福2017-05-16 16:54:38
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'
];
}
迷茫2017-05-16 16:54:38
/app/Http/Kernel.php
第31
行AppHttpMiddlewareVerifyCsrfToken::class,
Delete or comment
淡淡烟草味2017-05-16 16:54:38
It would be better if you take your routing out of the web middleware group.