0
나는 cakephp 2 응용 프로그램을 가지고 있습니다. 나는 그것에 ssl을 추가했고, JavaScript를 사용하여 필드가 채워진 사이트의 양식이 하나있다. 양식은 JavaScript를 사용하여 제출된다. 보안 구성 요소를 활성화 한 후에는 사이트를 제출할 수 없습니다. 그 이유는이 형식에서 일부 양식 도우미를 사용하지 않았다는 것입니다. 특정 방법에 대한 보안 구성 요소를 우회하는 방법이 있다고 확신합니다. 많이 시도했지만 작동하지 않습니다.URL을 cakephp로 재 작성하여 모든 URL 앞에 www를 추가하십시오.
다음은 코드입니다.
응용 프로그램/컨트롤러/appcontroller.php
class AppController extends Controller {
public $components = array('Session',
'Auth'=> array(
'authenticate' => `array('Form' =>array('fields'=>array('username' => 'email'))))`,
'Acl' ,
'Email' => array('from' => '[email protected]', 'sendAs' => 'html',
)
,'Security'=> array('allowedControllers'=>array('tests','live_tests'),'allowedActions'=>array('taketest','create_test'))
);
public $helpers = array('Html', 'Form','Session','Js');
function beforeFilter() {
Security::setHash('md5');
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginError = 'Invalid Username or Password.';
$this->Auth->authError = "You are not authorized to access.";
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
$this->Auth->authorize = 'Actions';
$this->Auth->actionPath = 'Controllers/';
$this->Security->blackHoleCallback = 'forceSSL';
$this->Security->requireSecure();
}
public function forceSSL() {
$this->redirect('https://' . env('SERVER_NAME') . $this->here);
}
}
내가 AppController가
에서 내가 사용하려는 양식을 HTTPS를 강제 컨트롤러라는 testcontroller에 있고 방법이라고 시험
시간 내 주셔서 감사합니다!
당신은 웹 서버가 이것을 다시 쓰게 할 수 있습니다. 어떤 유형의 웹 서비스를 실행하고 있습니까? –
나중에 나는이 응용 프로그램이 빌드 된 이후로 다른 양식의 몇 가지에 대해서도 같은 문제가 있다고 생각했다. @ ColbyGuyer 나는 APACHE를 사용하고있다 – harikrish
나는 또한 config에서 https도 할 것이다. –