From 943fcbb69fa96f6d6e76b2afef62bd87d46c1f1e Mon Sep 17 00:00:00 2001 From: André Manoel Date: Thu, 11 May 2017 13:02:49 -0300 Subject: [PATCH] Adicionando mais regras no CORS para Download dos arquivos --- controlador_ws.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/controlador_ws.php b/controlador_ws.php index 745c381..c01ee04 100644 --- a/controlador_ws.php +++ b/controlador_ws.php @@ -48,10 +48,15 @@ $app->options('/{routes:.+}', function ($request, $response, $args) { $app->add(function ($req, $res, $next) { $response = $next($req, $res); - return $response - ->withHeader('Access-Control-Allow-Origin', '*') - ->withHeader('Access-Control-Allow-Headers', 'X-Requested-With, Content-Type, Accept, Origin, Authorization, token') - ->withHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); + + //cabeçalhos encontrados na implementação do Mobile + $strAllowHeaders = 'X-Requested-With, Content-Type, Accept, Origin, Authorization, ' . + 'token, User-Agent, Cookie, Content-Disposition, Content-Length, Transfer-Encoding, Accept-Encoding'; + + return $response->withHeader('Access-Control-Allow-Origin', 'http://localhost:8100') //Especifico para o IONIC + ->withHeader('Access-Control-Allow-Headers', $strAllowHeaders) + ->withHeader('Access-Control-Allow-Credentials', 'true') + ->withHeader('Access-Control-Allow-Methods', 'GET, PUT, POST, DELETE, OPTIONS'); }); /** -- libgit2 0.21.2