如何将相同的源策略应用于IP地址 [英] How does the same origin policy apply to IP addresses
问题描述
我的公司内部网上有一台运行JBoss的服务器。我想从我的机器(也在Intranet上)向此服务器发送API调用,并使用JQuery获取生成的XML响应。
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 using JQuery.
我在维基百科上阅读了该条目但我很困惑这是如何适用于我的情况,因为我们的机器只有IP地址,而不是域名。
I read the entry on Wikipedia but am confused how that applies to my situation, since our machines only have IP addresses, not domain names.
我有
- 服务器网址:10.2 .200.3:8001 / serviceroot / service
- 客户端IP地址:10.2.201.217
- server URL: 10.2.200.3:8001/serviceroot/service
- client IP address: 10.2.201.217
我的问题是:
- 据我所知,这些是不同的域名,对吧?所以我必须使用代理来发出对服务器的JQuery.ajax调用
- 如果我想避免做(2),我可以在服务器上安装Apache并使用JS服务器页面那里的代码表格?但是JS将从10.2.200.3开始,服务器将在10.2.200.3:8001。根据政策,这些被认为是不同的域名吗?
谢谢!
推荐答案
-
是。
Yes.
是的,不同的端口意味着不同的起源。这是大多数浏览器在JS中已经做了一段时间的事情,但它在 HTML5草案,由 XMLHttpRequest草案引用。
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.
如果A和B的端口组件不相同,返回false。
If A and B have port components that are not identical, return false.
这篇关于如何将相同的源策略应用于IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!