Pergunta

I have my web application deployed on Web Sphere Server.

I also have my HTML pages present as web content on Apache. These web pages are trying to grab the response from the service deployed on Web Sphere using AJAX. While doing this I get error on browser console saying No 'Access-Control-Allow-Origin' header is present on the requested resource.

Both the servers Apache, Web Sphere are running on the same machine but just different ports (of course). Then why is the question of allowing origin comes? Can someone please explain?

To be more precise:

http://localhost:8080/someHtmlPage.html is making an AJAX call to service deployed at http://localhost:9081/someContext/someService for consuming the response.

Most of the links I have seen have this problem because their domain is different but in my case the domain should remain the same.

I have looked at this and this

Another question I have is making Access-Control-Allow-Origin entry with * solves the issue?

Foi útil?

Solução

The origin varies with the port number.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top