New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Access-Control-Allow-Headers
for browsers
#2186
Comments
karmi
added a commit
to sous-chefs/elasticsearch
that referenced
this issue
Aug 17, 2012
karmi
added a commit
to sous-chefs/elasticsearch
that referenced
this issue
Aug 18, 2012
Tested with the following code opened from `file://` location and from an HTML page at different domain then myserver.com: jQuery.ajax({ url: "http://myserver.com/_search", type: "POST", contentType: 'application/json; charset=UTF-8', success: function(data) { console.log(data)} }); See elastic/elasticsearch#2186.
kimchy
pushed a commit
that referenced
this issue
Sep 6, 2012
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
mute
pushed a commit
to mute/elasticsearch
that referenced
this issue
Jul 29, 2015
Previously, when responding to Ajax requests, elasticsearch did not send proper headers for cross-origin resource sharing (CORS) -- see issues elastic#828, elastic#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 elastic#2186, fixes elastic#828
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When accessing elasticsearch from JavaScript, the request fails if it contains a
Content-Type
header. To reproduce the issue, open a browser console on this page and paste (assuming elasticsearch is running onlocalhost:9200
):The current code adds a
Access-Control-Allow-Origin
header for browsers, but not aAccess-Control-Allow-Headers
.The text was updated successfully, but these errors were encountered: