user1834464
user1834464

Reputation:

No 'Access-Control-Allow-Origin' header is present on the requested resource

I have three ajax calls (POST, GET and PUT), all preceded by a preflight request (OPTIONS). The POST call creates a user, the GET call reads the user and the PUT call modifies this user. They are all chained calls with .then(). All the requests are cross-domain and the server has implemented CORS. All requests are made from the same origin to the same server (all to the same resource), but only the PUT request provoke the error in the title. The filter in the back-end to modify the header is the same for all requests (POST, GET, PUT, DELETE), so I really don't know why the request is cancelled. Also, the preflight request which is there to confirm that the server allows the PUT request to go through has no problem and comes back with a favorable access-control-allow-origin...

I also noticed that Chrome cancels the PUT request (maybe because the origin is not allowed) enter image description here

Hopefuly you can help me :D

Upvotes: 1

Views: 14563

Answers (1)

Lorenz
Lorenz

Reputation: 1303

The problem is that the request is made, but the execution of the (probably PHP) script fails due to some error before the Access-Control-Allow-Origin header is set.

Upvotes: 1

Related Questions