Problems with CORS in application using API with Slim framework and angularjs

0

Good afternoon friends

I'm having trouble solving a problem

Requisição cross-origin bloqueada: A política de mesma origem (Same Origin Policy) impede a leitura do recurso remoto em http://api.dominio.com.br/exemplo. (Motivo: o cabeçalho CORS 'Access-Control-Allow-Origin' é incompatível com 'http://api.dominio.com.br').

I've created an API using Slim to "feed" my application into AngularJS .

require "Slim/Slim.php";
require "CorsSlim/CorsSlim.php";

$app = new \Slim\Slim();

$corsOptions = array("origin" => "*", "allowMethods" => array("POST, GET, OPTIONS, PUT, DELETE"));

$cors = new \CorsSlim\CorsSlim($corsOptions);

$app->add($cors);
//e aqui vem as rotas
$app->run();

I searched for StackoverFlow before opening this poll, and I contacted to see if my hosting was CORS enabled. How and a shared hosting the same and disabled. I would like some help to solve this question, thank you.

Response from RESTClient :

Status Code: 200 OK
Access-Control-Allow-Headers: X-Authorization,X-Requested-With
Access-Control-Allow-Methods: POST,GET,DELETE,PUT,OPTIONS
Age: 0
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html
Date: Tue, 12 Jul 2016 00:03:56 GMT
Server: nginx/1.4.4
Transfer-Encoding: chunked
Vary: Accept-Encoding
Via: 1.1 varnish
X-Cacheable: YES
X-Varnish: 1680708969
access-control-allow-origin: *
magicmarker: 1
    
asked by anonymous 07.07.2016 / 20:26

0 answers