diff --git a/app/AppKernel.php b/app/AppKernel.php index 2e8f749..1edbd9c 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -18,6 +18,7 @@ public function registerBundles() new AppBundle\AppBundle(), new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), new UnderDevCrew\Bundle\PlacesApiBundle\UnderDevCrewPlacesApiBundle(), + new Nelmio\CorsBundle\NelmioCorsBundle(), ]; if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { diff --git a/app/config/config.yml b/app/config/config.yml index a640365..c442e1d 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -68,3 +68,19 @@ swiftmailer: username: "%mailer_user%" password: "%mailer_password%" spool: { type: memory } + +nelmio_cors: + defaults: + allow_credentials: false + allow_origin: [] + allow_headers: [] + allow_methods: [] + expose_headers: [] + max_age: 0 + hosts: [] + origin_regex: false + paths: + '^/': + allow_origin: ['*'] + allow_methods: ['GET'] + max_age: 3600 diff --git a/composer.json b/composer.json index 8582cd4..4f14e62 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,8 @@ "phpunit/phpunit": "^5.3", "nekland/base-api": "dev-master", "nekland/places-api": "dev-master", - "guzzlehttp/guzzle": "^5.3" + "guzzlehttp/guzzle": "^5.3", + "nelmio/cors-bundle": "^1.4" }, "require-dev": { "sensio/generator-bundle": "^3.0", diff --git a/composer.lock b/composer.lock index 0ae17d2..0ed85e8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "263855426fd91641acf6fc89c5bb4fe5", - "content-hash": "e994de0bbe8d587c52408ad3ab0f18d1", + "hash": "c8349e0452576556469caa6e0caf8db3", + "content-hash": "38de2f81ff23311177709d8d99467c5b", "packages": [ { "name": "doctrine/annotations", @@ -1487,6 +1487,63 @@ }, "time": "2016-04-06 01:38:07" }, + { + "name": "nelmio/cors-bundle", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/nelmio/NelmioCorsBundle.git", + "reference": "fa14a81737c605bf4766054cdcb72a16a433d537" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nelmio/NelmioCorsBundle/zipball/fa14a81737c605bf4766054cdcb72a16a433d537", + "reference": "fa14a81737c605bf4766054cdcb72a16a433d537", + "shasum": "" + }, + "require": { + "symfony/framework-bundle": "^2.2 || ^3.0" + }, + "require-dev": { + "matthiasnoback/symfony-dependency-injection-test": "^0.7.6", + "mockery/mockery": "0.9.*" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Nelmio\\CorsBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nelmio", + "homepage": "http://nelm.io" + }, + { + "name": "Symfony Community", + "homepage": "https://github.com/nelmio/NelmioCorsBundle/contributors" + } + ], + "description": "Adds CORS (Cross-Origin Resource Sharing) headers support in your Symfony2 application", + "keywords": [ + "api", + "cors", + "crossdomain" + ], + "time": "2015-12-09 17:26:34" + }, { "name": "ocramius/proxy-manager", "version": "1.0.2",