Laravel 7-什么可能导致间歇性419错误?
我有一个网站运行,Laravel 7在3个应用程序服务器中连接到1个数据库服务器。
3个应用程序服务器已安装了已安装。会话驱动程序被备忘。而且,我已经在Laravel配置中添加了3个服务器,以用于Memcached。
config/cache.php
...
'memcached' => [
'driver' => 'memcached',
'persistent_id' => 'memcached_pool_id',
'options' => [
// some nicer default options
// - nicer TCP options
Memcached::OPT_TCP_NODELAY => TRUE,
Memcached::OPT_NO_BLOCK => FALSE,
// - timeouts
Memcached::OPT_CONNECT_TIMEOUT => 2000, // ms
Memcached::OPT_POLL_TIMEOUT => 2000, // ms
Memcached::OPT_RECV_TIMEOUT => 750 * 1000, // us
Memcached::OPT_SEND_TIMEOUT => 750 * 1000, // us
// - better failover
Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT,
Memcached::OPT_LIBKETAMA_COMPATIBLE => TRUE,
Memcached::OPT_RETRY_TIMEOUT => 2,
Memcached::OPT_SERVER_FAILURE_LIMIT => 1,
Memcached::OPT_AUTO_EJECT_HOSTS => TRUE,
],
'servers' => [
[
'host' => 'ip1',
'port' => '11211',
'weight' => 100,
],
[
'host' => 'ip2',
'port' => '11211',
'weight' => 100,
],
[
'host' => 'ip3',
'port' => '11211',
'weight' => 100,
]
]
]
verifycsrftkoken中间件处于活动状态,大多数时候一切都起作用,但是有些请求会抛出419个错误(随机),即使它们发送了适当的cookie(laravel session和csrf token)和Memcached Store具有会话数据。
发生错误时,可能会在失败之前或之后成功请求。
还有其他可能导致这个问题的吗?
I have a website running with Laravel 7 in 3 app servers connected to 1 database server.
The 3 app servers have memcached installed. The session driver is memcached. And I've added the 3 servers in the Laravel configuration for memcached.
config/cache.php
...
'memcached' => [
'driver' => 'memcached',
'persistent_id' => 'memcached_pool_id',
'options' => [
// some nicer default options
// - nicer TCP options
Memcached::OPT_TCP_NODELAY => TRUE,
Memcached::OPT_NO_BLOCK => FALSE,
// - timeouts
Memcached::OPT_CONNECT_TIMEOUT => 2000, // ms
Memcached::OPT_POLL_TIMEOUT => 2000, // ms
Memcached::OPT_RECV_TIMEOUT => 750 * 1000, // us
Memcached::OPT_SEND_TIMEOUT => 750 * 1000, // us
// - better failover
Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT,
Memcached::OPT_LIBKETAMA_COMPATIBLE => TRUE,
Memcached::OPT_RETRY_TIMEOUT => 2,
Memcached::OPT_SERVER_FAILURE_LIMIT => 1,
Memcached::OPT_AUTO_EJECT_HOSTS => TRUE,
],
'servers' => [
[
'host' => 'ip1',
'port' => '11211',
'weight' => 100,
],
[
'host' => 'ip2',
'port' => '11211',
'weight' => 100,
],
[
'host' => 'ip3',
'port' => '11211',
'weight' => 100,
]
]
]
The VerifyCsrfToken middleware is active, and most of the time everything works, but there are some requests that throw a 419 error (randomly), even though they send the appropriate cookies (laravel session and csrf token), and the memcached store has the session data.
When the error occurs, there might've been successful requests before or after the failure.
Is there anything else that could be causing this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论