Commit 943fcbb69fa96f6d6e76b2afef62bd87d46c1f1e
1 parent
57e202b8
Exists in
master
and in
1 other branch
Adicionando mais regras no CORS para Download dos arquivos
Showing
1 changed file
with
9 additions
and
4 deletions
Show diff stats
controlador_ws.php
... | ... | @@ -48,10 +48,15 @@ $app->options('/{routes:.+}', function ($request, $response, $args) { |
48 | 48 | |
49 | 49 | $app->add(function ($req, $res, $next) { |
50 | 50 | $response = $next($req, $res); |
51 | - return $response | |
52 | - ->withHeader('Access-Control-Allow-Origin', '*') | |
53 | - ->withHeader('Access-Control-Allow-Headers', 'X-Requested-With, Content-Type, Accept, Origin, Authorization, token') | |
54 | - ->withHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); | |
51 | + | |
52 | + //cabeçalhos encontrados na implementação do Mobile | |
53 | + $strAllowHeaders = 'X-Requested-With, Content-Type, Accept, Origin, Authorization, ' . | |
54 | + 'token, User-Agent, Cookie, Content-Disposition, Content-Length, Transfer-Encoding, Accept-Encoding'; | |
55 | + | |
56 | + return $response->withHeader('Access-Control-Allow-Origin', 'http://localhost:8100') //Especifico para o IONIC | |
57 | + ->withHeader('Access-Control-Allow-Headers', $strAllowHeaders) | |
58 | + ->withHeader('Access-Control-Allow-Credentials', 'true') | |
59 | + ->withHeader('Access-Control-Allow-Methods', 'GET, PUT, POST, DELETE, OPTIONS'); | |
55 | 60 | }); |
56 | 61 | |
57 | 62 | /** | ... | ... |