snelg / cakephp-cors

CORS plugin for CakePHP 3
19 stars 2 forks source link

CORS for Multiple Controllers? #12

Closed elogicmedia closed 8 years ago

elogicmedia commented 8 years ago

How do I go about adding CORS for multiple controllers?

Single works like this as per your example for me no worries:

DispatcherFactory::add('Cors.Cors', ['routes' => [ 'Employees' ]]);

HOWEVER trying this for multiple controlers doesn't? I guess this is wrong.

DispatcherFactory::add('Cors.Cors', ['routes' => [ 'Employees', 'LabourLevels' ]]);

Thanks

snelg commented 8 years ago

That should be the proper syntax. I just tried it myself with multiple controllers, and it worked properly:

DispatcherFactory::add('Cors.Cors', ['routes' => [
    'Members', 'Clubs', 'AuditDeltas'
]]);

I'm afraid I don't have any other specific debugging suggestions off the top of my head.

elogicmedia commented 8 years ago

Thanks for the reply, the issue ended up being within my cake app and not your plugin. Sorry about that.