KeidaS
November 22, 2018, 9:05am
1
Hello everyone,
I'm developing an aplication using Angular 6 and Plone 5.1.4 with the Plone RESTAPI (GitHub - plone/plone.restapi-angular: A simple Angular SDK to build web sites easily on top of the Plone RESTAPI )
Everything it's fine but i can't enable CORS on the Backend (Plone), I can't set the Access-Control-Allow-Origin, or I don't know how to do it.
The plone instance is running on the port 8080 of my server and the Angular application is running on the port 80 with Apache.
I've read this thread before and I tried to do what he mentions on the first comment, but it doesn't work.
I want to set the allow_origin to a sub domain, for example app.example.com where the Plone site is running on example.com . The plone.rest package provides a zcml setting for that, but i don't see any allow_origin headers after adding this setting as described in the docs:
What do I miss here?
@datakurre @ramon @tisto any ideas?
Anyone have any leads or sugestion of how I can enable it?
Thanks for reading.
ebrehault
(Eric Bréhault)
November 22, 2018, 9:29am
2
Hi @KeidaS ,
You need to add a directive in your site.zcml. You will get all the details here:
Plone support for HTTP verbs (GET, POST, PUT, DELETE, ...) - plone/plone.rest
1 Like
KeidaS
November 22, 2018, 7:15pm
3
Thanks @ebrehault !!!!!!
This is how I solved it:
I added the following lines to the size.zcml (located on "zeocluster/parts/client1/etc/")
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta"
xmlns:five="http://namespaces.zope.org/five"
xmlns:plone="http://namespaces.plone.org/plone">
<plone:CORSPolicy
allow_origin="*"
allow_credentials="true"
expose_headers="Content-Length,X-My-Header"
allow_headers="Accept,Authorization,Content-Type,X-Custom-Header"
max_age="3600"
/>
Finally I removed the <plone:CORSPolicy lines on the 999-additional-overrides.zcml located on "zeocluster/parts/client1/etc/package-includes".
Thanks again!!
MrTango
(Maik Derstappen)
November 28, 2018, 10:25am
4
I wouldn't customize the site.zcml directly if you use buildout.
Instead at the same zcml with a zcml-additional = parameter insid your instance part in your buildoud confiuration.
jaroel
(Roel Bruggink)
November 28, 2018, 10:43am
5
mtrebron
(Norbert )
July 22, 2019, 1:09pm
6
1 Like