DELETE and PUT request response ERROR

(Andrey Veryovkin) #1

DELETE and PUT request response ERROR
Method DELETE is not allowed by Access-Control-Allow-Methods in preflight response.

return Observable.fromPromise(new Promise((resolve, reject) => {
    let xhr = new XMLHttpRequest();

    let data = new FormData();
    data.append("api_key", user.api_key);
    data.append("api_username", user.api_username);
    data.append("post_action_type_id", topicActionsId);

    xhr.onreadystatechange = function() {
      if (xhr.readyState === 4) {
        if (xhr.status === 200) {
        } else {
    };'DELETE','' + topicId, true);
    xhr.setRequestHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, DELETE');
    xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
    xhr.setRequestHeader('Access-Control-Allow-Headers', 'Content-Type')

(Robin Ward) #2

Have you enabled CORS?

(Alex Kleshchevnikov) #3

@eviltrout Is it possible to enable CORS from administrative area? Because not sure our plan allows to edit app.xml fileā€¦

I mean we have added from Admin URL for CORS. Why DELETE and PUT requests still not working? Is it possible to fix it from Admin?

(Andrey Veryovkin) #4

CORS enabled
GET and POST methods working
But we have problems with DELETE and PUT requests
Also when CORS plugin enabled in browser they working.

(Edwin Mhoy Silva) #6

Did you solve your issue ?