How does the same origin policy apply to IP addresses

前端 未结 2 486
故里飘歌
故里飘歌 2021-01-05 22:51

I have a server on our company intranet that runs JBoss. I want to send API calls to this server from my machine, also on the intranet, and get the resulting XML responses u

相关标签:
2条回答
  • 2021-01-05 23:10
    1. Yes.

    2. Yes, different ports mean different origins. This is something that most browsers have done in JS for a while, but it is explicitly described in the HTML5 draft, which is referenced by the XMLHttpRequest draft.

    If A and B have port components that are not identical, return false.

    0 讨论(0)
  • 2021-01-05 23:18

    If the port, or address are different, they are different domains. If you need to access information from what is effectively another server you really have two options. One is to write some sort of reverse proxy to pass your requests from the same origin server to the secondary server.

    Alternatively, if you are in control of the secondary target, and there's no security risk in providing direct access, you could consider adjusting the secondary server to emit JSON-P responses.

    0 讨论(0)
提交回复
热议问题