I send an angularjs $http post request to a java backend:
var url = 'http://192.168.88.245:9000/dologin';
$http.post(url,
{
"email" : "admin@admin.com",
"password" : "1"
},
{
withCredentials: true
}
)
In response i get this error:
OPTIONS http://192.168.88.245:9000/dologin
(index):1 XMLHttpRequest cannot load http://192.168.88.245:9000/dologin. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 404.
But when i use Advanced Rest Client
extension for chrome and sending same request with it, Server send 200 OK. This is the header in rest extension response:
Response headers
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
Access-Control-Allow-Credentials: true
Content-Type: application/json; charset=utf-8
Access-Control-Max-Age: 300
Content-Length: 1181
What is the difference in this two situations?