0

来自 instamojo api 的响应已成功提取,但问题是 webhook 服务无法正常工作。在此,我在请求中提供了一个 webhook url,我想排除 CSRF 验证,因为我已经'instamojo/*'在中间件中包含了 except 数组,但仍然没有用。

class VerifyCsrfToken extends Middleware
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        'instamojo/*',
    ];
} 

当前路线

Route::post('webhook','HomeController@webhook');
4

1 回答 1

0

可以通过在中间件的 except 部分添加发布路由名称来解决。在这里我添加webhook/*了我的中间件。

路线

Route::post('webhook','HomeController@webhook');

中间件

class VerifyCsrfToken extends Middleware
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        'webhook/*',
    ];
}

它工作正常。谢谢。

于 2018-06-23T06:09:26.043 回答