samedi 28 novembre 2015

Not able to call my api throwing error Disallowed for cross-origin requests that require preflight

Hey I am new to ember and frontend thing.My backend is designed using django.All my api endpoint ends with " / "(ex:http://ift.tt/1hY3S2b).Now when I call this api's from ember app.It send the requests to "http://ift.tt/1OlP1vf" and leaves the end " / ".

some codes snippet are:

routes.js:

return this.store.findRecord('feed');

model name is feed.

adapter.js:

host:"http://example.com/api",
headers:{'authorization:"abc"}

THE ERROR IN CONSOLE IS:

The request was redirected to 'http://ift.tt/1hY3S2b', which is disallowed for cross-origin requests that require preflight.

So it is redirecting to correct api end point but cors is not allowing the requests to happen.

Is there a way to call the api with " / "at end through ember.




Aucun commentaire:

Enregistrer un commentaire