我使用 webhook 来获取更新,但现在机器人无法从电报服务器获取更新。我正在使用 Laravel 5.8。我用 getWebhookInfo 检查了 webhook,它返回了
{"ok":true,"result"{"url":"https://example.com/bot_commands","has_custom_certificate":false,"pending_update_count":15,"last_error_date":1569065002,"last_error_message":"Wrong response from the webhook: 419 proxy reauthentication required","max_connections":40}}
如何解决这个错误?感谢帮助
419proxy reauthentication required 意味着为您的 webhook 路由启用了 CSRF 保护。应仅对 Webhook 路由禁用 CSRF 保护,为此,请在项目上打开文件VerifyCsrfToken.php。
dir — App\Http\Middleware\VerifyCsrfToken.php
<?phpnamespace App\Http\Middleware;use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;class VerifyCsrfToken extends BaseVerifier{ protected $except = [ 'payment/*', // routes group 'specific-route', // specific route ];}