跨域XMLHttprequest

问题描述:

这里是我的情况:

我有一个Webserver机器,客户端机器和第三个机器运行一些监听XMLHttpRequests的程序。

I have a Webserver machine, Client machine, and a third machine running some program that listens for XMLHttpRequests.

客户端从客户端计算机访问Web服务器,进行一些更改,然后单击保存。此时,数据被发送回Web服务器和第三台机器。所有这一切都是使用Javascript和XMLHttpRequest对象完成的。

Client accesses the Webserver from the Client machine, makes some changes, and then clicks on'Save'. At this point, data is being sent back to the Webserver and to the Third machine. All of this is being done using Javascript and XMLHttpRequest object.

对于Webserver的帖子工作正常,但是对第三台机器的发布不工作,因为它有一个不同的IP /域。

The post to the Webserver works fine, however post to the Third machine does not work, since it had a different IP/domain.

如何使这项工作?
客户端机器 - >第三台机器不工作,因为它在不同的域
Webserver机器 - >第三台机器不工作,因为防火墙问题

How can I make this work? Client machine -> Third machine does not work, because its on a different domain Webserver machine -> Third machine does not work, because of firewall issues

任何想法都非常感谢!

您可以实现 CORS

You can implement CORS (Cross-Origin Resource Sharing) on your server.

当前版本的服务器上安装了一个新的资源共享服务器,您可以在服务器上使用.w3.org / TR / cors /rel =nofollow主要的桌面浏览器已经支持了一段时间,Opera和Explorer 10是最后添加支持的。

The current versions of the major desktop browsers have supported it for a while, Opera and Explorer 10 being the last ones to add support.

我不知道CORS在移动浏览器这时候。

I'm not sure how widely supported CORS is across mobile browsers at this time though.