Saha Posted January 9, 2018 Share Posted January 9, 2018 Failed to load http://localhost:9200/thirtybees11/_search: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://thirtybee.local' is therefore not allowed access. Link to comment Share on other sites More sharing options...
lesley Posted January 9, 2018 Share Posted January 9, 2018 Are you using the domain thirtybees.local? Or is that something we left in the module? Link to comment Share on other sites More sharing options...
Saha Posted January 9, 2018 Author Share Posted January 9, 2018 @lesley thirtybee.local is my local virtual host. Link to comment Share on other sites More sharing options...
lesley Posted January 9, 2018 Share Posted January 9, 2018 It sounds like then you need to set the cors policy of your local instance to be able to connect to your elastic instance. https://enable-cors.org/server_apache.html Link to comment Share on other sites More sharing options...
Saha Posted January 9, 2018 Author Share Posted January 9, 2018 @lesley I did try this . Put the code in apache conf,virtual host as well as .htaccess still no luck . Link to comment Share on other sites More sharing options...
lesley Posted January 9, 2018 Share Posted January 9, 2018 I am not positive, but it might require a domain name being attached and then adding a content policy for the domain. Link to comment Share on other sites More sharing options...
Saha Posted January 9, 2018 Author Share Posted January 9, 2018 @lesley I didn't get you. If you don't mind . Can you elaborate. Link to comment Share on other sites More sharing options...
lesley Posted January 9, 2018 Share Posted January 9, 2018 It looks like you are using localhost for your elastic instance, it might require you to use a domain name instead of a local host. @mdekker might be best suited to answer this one. Link to comment Share on other sites More sharing options...
Saha Posted January 9, 2018 Author Share Posted January 9, 2018 @lesley You mean it will work fine on domain and not on local host. Thankyou. Link to comment Share on other sites More sharing options...
lesley Posted January 9, 2018 Share Posted January 9, 2018 Possibly, you would need to test it though. Link to comment Share on other sites More sharing options...
bzndk Posted January 9, 2018 Share Posted January 9, 2018 I think lesley is right. The issue here is you need to run it thrue Apache or Nginx in proxy, and make sure the config for that proxy has the right headers set for Access-Control-Allow-Origin. Apache Header set Access-Control-Allow-Origin "*" Nginx add_header 'Access-Control-Allow-Origin' '*'; Link to comment Share on other sites More sharing options...
bzndk Posted January 9, 2018 Share Posted January 9, 2018 Actually found some more info, it looks like in the configuration of Elasticsearch you can setup CORS to there is some more info about it on https://github.com/elastic/elasticsearch/issues/9031 Link to comment Share on other sites More sharing options...
Saha Posted January 11, 2018 Author Share Posted January 11, 2018 Setting http.cors.enabled : true http.cors.allow-origin : "*" In Elastic config located at config/elasticsearch.yml Fixed the Issue. But Now i am getting { "error":{ "root_cause":[ { "type":"illegal_argument_exception", "reason":"query malformed, empty clause found at [1:533]" } ], "type":"illegal_argument_exception", "reason":"query malformed, empty clause found at [1:533]" }, "status":400 } Link to comment Share on other sites More sharing options...
bzndk Posted January 11, 2018 Share Posted January 11, 2018 Hmm revert back to the settings before you change, i think it's better to proxy it via nginx since Elastic Search can be a bit of a PITA. Link to comment Share on other sites More sharing options...
Saha Posted January 11, 2018 Author Share Posted January 11, 2018 { “error”:{ “rootcause”:[ { “type”:“illegalargumentexception”, “reason”:“query malformed, empty clause found at [1:533]” } ], “type”:“illegalargument_exception”, “reason”:“query malformed, empty clause found at [1:533]” }, “status”:400 } @lesley @mdekker Anyone Link to comment Share on other sites More sharing options...
bzndk Posted January 11, 2018 Share Posted January 11, 2018 hmm in the elastic search module is the query missing there something sounds like it in my mind. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now