Commit 2abff064a3063394d799b8b24977154b26ae8474
1 parent
943fcbb6
Exists in
master
and in
1 other branch
Retirando CORS colocado no SLIM
Showing
1 changed file
with
0 additions
and
18 deletions
Show diff stats
controlador_ws.php
| @@ -41,24 +41,6 @@ $config = array( | @@ -41,24 +41,6 @@ $config = array( | ||
| 41 | 41 | ||
| 42 | $app = new \Slim\App($config); | 42 | $app = new \Slim\App($config); |
| 43 | 43 | ||
| 44 | -//Enable CORS | ||
| 45 | -$app->options('/{routes:.+}', function ($request, $response, $args) { | ||
| 46 | - return $response; | ||
| 47 | -}); | ||
| 48 | - | ||
| 49 | -$app->add(function ($req, $res, $next) { | ||
| 50 | - $response = $next($req, $res); | ||
| 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'); | ||
| 60 | -}); | ||
| 61 | - | ||
| 62 | /** | 44 | /** |
| 63 | * Grupo para a versao v1 de servicos REST | 45 | * Grupo para a versao v1 de servicos REST |
| 64 | */ | 46 | */ |