PHRAS-1180 Add configuration entry to enable CORS on custom paths

This commit is contained in:
Thibaud Fabre
2016-07-12 14:22:12 +02:00
parent 65e666ee98
commit 9ca8dee44f
2 changed files with 6 additions and 0 deletions

View File

@@ -191,6 +191,7 @@ api_cors:
expose_headers: [] expose_headers: []
max_age: 0 max_age: 0
hosts: [] hosts: []
api_cors_paths: []
session: session:
idle: 0 idle: 0
lifetime: 604800 # 1 week lifetime: 604800 # 1 week

View File

@@ -93,6 +93,11 @@ class HttpStackMetaProvider implements ServiceProviderInterface
$paths['/api/v\d+/'] = $config; $paths['/api/v\d+/'] = $config;
$paths['/download/'] = $config; $paths['/download/'] = $config;
} }
if (isset($app['phraseanet.configuration']['api_cors_paths'])) {
foreach ($app['phraseanet.configuration']['api_cors_paths'] as $path) {
$paths[$path] = $config;
}
}
} }
return new DefaultProvider($paths, []); return new DefaultProvider($paths, []);