zainudin noori
zainudin noori

Reputation: 191

-- No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access

while trying to access http:Localhost:9000/api/post from provider i get this error

Failed to load http://127.0.0.1:8000/api/post: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access. is therefore not allowed access

any knows what is wrong.

Upvotes: 4

Views: 8802

Answers (1)

ankit bhardwaj
ankit bhardwaj

Reputation: 56

Your front and back end are on different ports which means your ajax requests are subject to cross origin security.

You need to do changes at your back-end api (server side) by adding

Access-Control-Allow-Origin: "*";

in response headers according to the language you are using php,java or python e.t.c.

Upvotes: 1

Related Questions