REST CORS post no answers

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

0 votes

1 answers

2013 views

ANSWER

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

Haven't tried it yet, but according the documentation: http://doc.nuxeo.com/pages/releaseview.action?pageId=14257084 The default value is "GET, POST, HEAD, OPTIONS". But I shall try it and report back :-)
02/04/2014

I'm sorry Florent but it didn't work :-(
02/04/2014



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

0 votes



That could be a factor yes. Could you try without SSL first?
03/18/2014