Skip to content

Commit 30a20db

Browse files
Lednickdzubchik
authored andcommitted
Add CORS (#10)
* add CORS config * added CORS to AppKernel
1 parent 4ff4458 commit 30a20db

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

app/AppKernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public function registerBundles()
1414
new Symfony\Bundle\MonologBundle\MonologBundle(),
1515
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
1616
new Webhook\Bundle\WebhookBundle(),
17+
new Nelmio\CorsBundle\NelmioCorsBundle(),
1718
];
1819

1920
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {

app/config/config.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,13 @@ doctrine:
5252
orm:
5353
auto_generate_proxy_classes: '%kernel.debug%'
5454
naming_strategy: doctrine.orm.naming_strategy.underscore
55-
auto_mapping: true
55+
auto_mapping: true
56+
57+
nelmio_cors:
58+
paths:
59+
'^/':
60+
origin_regex: true
61+
allow_origin: "*"
62+
allow_headers: "*"
63+
allow_methods: ['PATCH', 'POST', 'PUT', 'GET', 'DELETE', 'OPTIONS']
64+
max_age: 3600

0 commit comments

Comments
 (0)