Would you please provide the requests that fail in your browser ? (You can copy them from the Networks tab in your browser's devtools). Please make sure to remove any sensitive or personal information from the requests though.
Also, which origin your web application is served from? (the address that you see in the browser address bar)
my web server&was is tomcat.
Connect to localhost: 8080 in a browser.
I think, this setting is the same origin.
is it right?
Do I need to add the same origin setting in my current situation?
If so, how do I solve the above error(refused to set unsafe...)?
How can I set it up like the picture below?
The picture below was captured at demo.elastic.co.
It seems that you are adding those headers manually in your frontend application and that's why the browser is showing those errors. In other words having xmlHttpRequest.setRequestHeader("Origin","*"); is not valid. These headers are automatically added by the browser to the OPTIONS request that the browser sends before the original POST request.
Only your backend (Java) application should be able to respond appropriately with the headers stated in our documentation.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.