plone / buildout.coredev

Plone Core Development Buildout
http://docs.plone.org/develop/coredev/docs/
74 stars 75 forks source link

setting CORS headers #820

Open flipmcf opened 2 years ago

flipmcf commented 2 years ago

The docker images are running this to get CORS errors to go away:

https://github.com/plone/plone-backend/blob/6.0.x/skeleton/scripts/cors.py

I'm thinking this needs to be written to zcml - as they do it, but maybe from settings from zope.conf and maybe some default variables in buildout.cfg or mx.ini

Thoughts?

davisagli commented 2 years ago

@flipmcf Assuming your package's zcml is already loaded in the buildout configuration (i.e. in the zcml = setting for plone.recipe.zope2instance, or using plone.autoinclude) you should be able to simply put this zcml inside your Python package in overrides.zcml (or another file included from there)

flipmcf commented 2 years ago

This is exactly how I'm handling it now. I'm thinking into the future where you can configure your backend site-settings and store these in the registry.

the use-case is that I want a UI interface (so I don't have to code). Also, consider the use case where zope/plone installs that run multiple sites through VHM and each needs it's own CORS config. Not my use case specially, but definitely others have this.