Angular JSからエラスティックサーチWebサービスを呼び出したいとします。私は以下のようにそれを呼び出していた場合:プリフライトリクエストエラー:エラスティック検索で要求されたリソースに 'Access-Control-Allow-Origin'ヘッダーがありません
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"*
しかし、後:
XMLHttpRequest cannot load http://[IP]:9200/providers3/provider3/_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://localhost:8085" is therefore not allowed access.
は私がelasticsearch.yml以下のようにファイルに変更を加えた:
$http.post('http://[IP]:9200/providers3/provider3/_search',JSON.stringify(objToSend)).success(function(){
console.log('Data sent successfully!!');
});
私はこのエラーを取得していますこれらの行を.ymlファイルに追加すると、Elastic検索サーバーが起動しません。
誰でも助けてください。
CROSサポートを追加しましたか? – micronyks
CORSサポートは? –
CORSでangularjsを検索すると、多くの結果が得られます。あなたはその質問だけに属します。 – micronyks