如何解决Symfony 4.4.17 生产服务器上的注销问题
我在 Symfony 4.4.17 生产中遇到了一个奇怪的问题,在本地运行正常。
我在开发环境中使用 PHP 7.3.21,在生产环境中使用 PHP 7.3.23。
注销不起作用,prod.log 或浏览器控制台中没有错误。
security.yaml:
security:
encoders:
App\Entity\User:
algorithm: auto
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
app_user_provider:
entity:
class: App\Entity\User
property: email
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: lazy
guard:
authenticators:
- App\Security\AppAuthenticator
logout:
path: app_logout
target: homepage
remember_me:
secret: '%kernel.secret%'
lifetime: 604800 # 1 week in seconds
path: /
form_login:
login_path: homepage
default_target_path: profile
use_referer: true
json_login:
check_path: signin_ajax
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#firewalls-authentication
# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
- { path: ^/admin,roles: ROLE_ADMIN }
SecurityController.php:
/**
* @Route("/logout",name="app_logout",methods={"GET"})
*/
public function logoutAction()
{
throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
}
cookie 好像没问题,这是数据:
有什么想法吗?
解决方法
对不起。有人写了一个与注销路径冲突的 .htaccess 规则。谜团解开
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。