DieSchittigs / contao-content-api-bundle

Contao JSON-API
MIT License
41 stars 9 forks source link

Allow configuration of CORS-Parameter #8 #9

Closed Firestorm87 closed 5 years ago

Firestorm87 commented 5 years ago

If you host contao on an other server than the SPA i get the following error while calling the REST-API:

Access to XMLHttpRequest at 'http://contao.localhost.local/api/' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Is it possible to add the configuration of allowed origins?

soletan commented 5 years ago

I've created https://github.com/cepharum/contao-cors a few days ago while working on a similar approach as provided by this extension here. It's focusing on handling and injecting CORS headers in every request.

Firestorm87 commented 5 years ago

Oh thanks for that advice. I will try it that way.