ionic yii2 Response for preflight has invalid HTTP status code 500
<p>I have a Ionic App and I'm trying to do a POST:</p>

<pre><code>$http({
  url: url+'/usuario/log', 
  method: 'POST',
  data: {usuario : $scope.data.usuario, senha:$scope.data.senha},
  headers : {'content-type':'application/json; charset=UTF-8'}
}).then(function(result) { ... });
</code></pre>

<p>On the server side I have a Yii2 application:</p>

<pre><code>public function actionLog(){
    header("Access-Control-Allow-Origin: *");
    header("Access-Control-Allow-Methods: *");
    header("Access-Control-Allow-Headers: content-type");

    $params = json_decode(file_get_contents('php://input'),true);
    $usuario = $params['usuario'];
    $senha = $params['senha'];

    ...
}
</code></pre>

<p>But the error I got is always this, I send a POST and get a OPTIONS </p>

<pre><code>OPTIONS http://www.nexusolucoes.com.br/personal/web/usuario/log
XMLHttpRequest cannot load http://www.nexusolucoes.com.br/personal/web/usuario/log. Response for preflight has invalid HTTP status code 500
</code></pre>