在带有SSL的实时服务器上(在nginx上)使用postLink()删除数据(在任何表单上)时出现以下错误:
URL mismatch in POST data (expected '/somewhere/delete/1001' but found
'/somewhere/delete/1001?url=%somewhere%2Fdelete%2F1001')
Cake\Controller\Exception\AuthSecurityException
toggle vendor stack frames
⟩ Cake\Controller\Component\SecurityComponent->_validatePost
CORE/src/Controller/Component/SecurityComponent.php, line 120
⟩ Cake\Controller\Component\SecurityComponent->startup
CORE/src/Event/EventManager.php, line 414
⟩ Cake\Event\EventManager->_callListener
CORE/src/Event/EventManager.php, line 391
⟩ Cake\Event\EventManager->dispatch
CORE/src/Event/EventDispatcherTrait.php, line 78
⟩ Cake\Controller\Controller->dispatchEvent
CORE/src/Controller/Controller.php, line 506
⟩ Cake\Controller\Controller->startupProcess
发布表单并保存它们完全正常。在请求期间,URL似乎在某处被重写。
HTML包含操作action="/somewhere/delete/1001"
所以这似乎很好。也许nginx重定向是以不允许的方式修改它。因为我有一条规则:
rewrite ^/project/abc/webroot/(.*) /project/abc/webroot/index.php?url=$1 last;
但是我无法在不获得404的情况下删除此重写。
但是,我可以以某种方式在beforeFilter中删除此URL吗?
答案 0 :(得分:2)
答案,何塞帮助了我。我有类似的东西:
try_files $uri $uri/ /index.php?$uri$uri$args;
应该是:
try_files $uri $uri/ /index.php?$uri$args;