2
我试图创建一个URL位置,其他服务可以使用cURL库发送json POST数据。即时得到400 apache的错误,并获取:黑洞请求从单独服务器卷曲发布CakePHP
**Security Error**
The requested address was not found on this server.
Request blackholed due to "auth" violation.
在CakePHP的应用程序试图禁用安全组件,并设置路由器正确的路线,但似乎并没有帮助。
这里是我的控制器动作,我的模型beforeFind和路线:
public function hello() {
$data = $this->request->data;
CakeLog::write('helloSignResponse', $data);
if ($data) {
$this->Security->validatePost = false;
CakeLog::write('helloSignResponse', $data);
if ($this->request->data['signature_request']['is_complete'] == true) {
$signature = $this->request->data['signature_request']["signature_request_id"];
$agent = $this->Agent->findBySignature('first', array('conditions' => $data['id'], 'feilds' => array('id')));
$this->Agent->id = $agent['Agent']['id'];
$this->User->id = $data['Agent']['user_id'];
if (!($this->Agent->saveFeild('status', 1) && $this->User->saveFeild('status', 1))) {
CakeLog::write('helloSign', 'Did Not update the user status and agent status');
}
}
return 'Hello API Event Received.';
}
}
//Model
public function beforeFilter() {
$this->Security->unlockedActions = array('hello');
if ($this->action == 'hello') {
$this->Security->csrfCheck = false;
$this->Security->validatePost = false;
}
}
//route
Router::connect('/hello', array('plugin' => 'PhoneKarma', 'controller' => 'Agents', 'action' => 'hello'));
还有什么我应该在CakePHP中做到防止这种或从其他服务器接受POST数据?
这是因为'beforeFilter'是一个控制器方法,而不是一个模型方法。 – dogmatic69