sokil / cors-bundle
Handling CORS requests
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 1
Type:symfony-bundle
Requires
- php: ^5.5 || ^7.0
- symfony/framework-bundle: ~2.3|~3.0
Requires (Dev)
- phpunit/phpunit: >=3.7.38 <6.0
- satooshi/php-coveralls: >=0.7.1 <2.0
- squizlabs/php_codesniffer: ^2.3
This package is auto-updated.
Last update: 2024-10-28 01:39:00 UTC
README
Handling CORS Requests
Installation
Add composer dependency:
composer.phar require sokil/cors-bundle
Register bundle in your AppKernel:
<?php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Sokil\CorsBundle\CorsBundle(), ); } }
Configuration
Configure bundle in your /app/config/config.yml
:
cors: allowedOrigins: # list of hosts, allowed to do CORS requests to your app. - https://fb.com - https://google.com withCredentials: true # allow send cookies to your hosts between requests maxAge: 86400 # agte of prefligt request cache
Useage
Listener CorsRequestListener
is listened to kernel events of requests and add headers if this is CORS request and CORS allowed for that host.