appbaseio / mirage

:art: GUI for simplifying Elasticsearch Query DSL
http://opensource.appbase.io/mirage
Other
2.21k stars 125 forks source link

Failed to connect to a default elasticsearch instance #46

Closed zhaoyi0113 closed 6 years ago

zhaoyi0113 commented 7 years ago

I have launched a default elasticsearch instance which is available on my local environment: http://localhost:9200. Open this url on my browser I get below output:

{
  "name" : "97Fvae4",
  "cluster_name" : "elasticsearch_joey",
  "cluster_uuid" : "NzKnO5UWRNW2AtqEr8CeAg",
  "version" : {
    "number" : "5.5.1",
    "build_hash" : "19c13d0",
    "build_date" : "2017-07-18T20:44:24.823Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.0"
  },
  "tagline" : "You Know, for Search"
}

but when I tried to use mirage to connect to this instance. I get an error dialog saying:
It looks like your app name, username, password combination doesn't match. Check your url and appname and then connect it again.

My instance doesn't have any username and password. I launched it by running elasticsearch on terminal. Why does it complain about username and password.

metagrover commented 6 years ago

Hi @zhaoyi0113, sorry for the late response. If you haven't got it working yet - https://github.com/appbaseio/mirage/issues/13 or https://github.com/appbaseio/mirage/issues/18 should help.

You just need to update your ES config:

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

I can confirm that this resolves the connection issue.

A small note: It is better from a security standpoint to only allow allow specific domains to have access to the cluster in the http.cors.allow-origin config value.

mikemaccana commented 4 years ago

Yeah a better options is: http.cors.allow-origin=http://localhost:1358,http://127.0.0.1:1358