elasticsearch.js client connection refused: Access-Control-Allow-Origin not recognized?

前端 未结 3 1025
长情又很酷
长情又很酷 2021-02-09 23:54

I\'ve been trying to ping a locally running elasticsearch using elasticsearch.jquery.min.js and I get a \"no living connection\" error each time.


ETA: In Chrome I

3条回答
  •  天涯浪人
    2021-02-10 00:08

    Just adding this to elasticsearch.yml should work.

    http.cors.enabled: true
    http.cors.allow-origin: "/.*/"
    http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
    http.cors.allow-headers: "X-Requested-With,X-Auth-Token,Content-Type,  Content-Length, Authorization"
    

    You don't need to add anything to Apache.

提交回复
热议问题