cancel
Showing results for 
Search instead for 
Did you mean: 

REST CORS post no answers

Bauke_Roo
Star Contributor
Star Contributor

Hi There,

Currently I'm trying to do a ajax call from a.domain.com (a website) to b.domain.com (nuxeo). In order to do this I extended the CORS with the following extension:

<?xml version="1.0"?>
<component name="nl.me.CORS-configuration">
    <extension target="org.nuxeo.ecm.platform.web.common.requestcontroller.service.RequestControllerService" point="corsConfig">
        <corsConfig name="CORS-API-CONFIG"
                    allowOrigin="https://a.domain.com https://b.domain.com";
                    allowSubdomains='true'>
            <pattern>/nuxeo/api/v1/path/.*</pattern>
        </corsConfig>
    </extension>
</component>

The GET method works fine:

jQuery.ajax({
    type: 'get',
    url: 'https://dm.openworkplace.nl/nuxeo/api/v1/path/default-domain/@children',
    crossDomain: true,
    xhrFields: {
        withCredentials: true
        }
    }
    );

However the post method does not work from a.domain.com, it does work from b.domain.com (nuxeo instance). It does not return a answer at all...

jQuery.ajax({
    type: 'POST',
    contentType: "application/json",
    dataType: "json",
    url: 'https://b.domain.com/nuxeo/api/v1/path/default-domain',
    data: '{"entity-type": "document", "name":"newDoc", "type": "File","properties": { "dc:title": "Specifications", "dc:description": "Created via a so cool and simple REST API", "common:icon": "/icons/file.gif", "common:icon-expanded": null, "common:size": null}}',
    crossDomain: true,
    xhrFields: {
        withCredentials: true
        });

The same command on the b.domain.com (with the nuxeo instance) works fine.

The server.log does not show anything.

Do you see if I'm doing anything wrong?

Thanks in advance, Bauke

5 REPLIES 5

Florent_Guillau
World-Class Innovator
World-Class Innovator

Have you tried adding supportedMethods=&quot;GET, POST&quot; to the &lt;corsConfig&gt; element?

Bauke_Roo
Star Contributor
Star Contributor

Haven't tried it yet, but according the documentation

Bauke_Roo
Star Contributor
Star Contributor

I'm sorry Florent but it didn't work

Bauke_Roo
Star Contributor
Star Contributor

An additional question on this. Could it be that Nuxeo is running on ssl?

That could be a factor yes. Could you try without SSL first?

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.