elasticsearch/elasticsearch — pull request #2238 by karmi (2012-09-06 08:21:04+00:00)
Title: Added proper headers for cross-origin resource sharing (CORS) with Ajax

Previously, when responding to Ajax requests, elasticsearch did not send proper headers for
cross-origin resource sharing (CORS) -- see issues #828, #2186.

With this commit, Ajax requests should be working. Example:

jQuery.ajax({
url: "http://localhost:9200/_search",
type: "POST",
contentType: 'application/json; charset=UTF-8',
success: function(data) { console.log(data) }
});

See:

* http://www.nczonline.net/blog/2010/05/25/cross-domain-ajax-with-cross-origin-resource-sharing/
* http://www.w3.org/TR/cors/#access-control-allow-headers-response-header

Closes #2186, fixes #828