我正在尝试从我的服务器获取数据,使用RemoteObject来完成。当我在我的本地主机上运行该应用程序时,它工作得很好,但是当我在我的服务器上使用它时,我得到了一个Channel.Security.Error(访问URL时出现安全错误)。
在服务器端日志中提到了跨域。77.127.194.4 -- 23/Oct/2008 21:15:11 "GET /crossdomain.xml HTTP/1.1“501
有没有人遇到过同样的问题?有什么想法吗?
发布于 2008-10-24 12:05:02
你有没有试过在你的crossdomain.xml (你从哪里获取东西)中添加这个:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.YOUR_FRAME_WORK_CROSSDOMAIN_POLICY.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*.YOUR_SITE_GOES_HERE.com" secure="false" />
<allow-access-from domain="*.YOUR_SITE_GOES_HERE.com" secure="false" />
</cross-domain-policy>capslock中的东西你可能不得不改变以适合你的框架。例如,我从我在macromedia flash中使用的版本中复制了它。代替"www.YOUR_FRAME_WORK_CROSSDOMAIN_POLICY.com/...“我通常有“www.macmedia.com/xml/dtds/...
我不确定,但试着调查一下,这可能是你的问题。对于跨域,你通常需要添加到服务器端,你的垃圾从哪里来,让其他网站获得它的权限。
发布于 2008-10-25 14:01:09
我已经找到了解决方案。关于crossdomain.xml文件,您是对的,但不幸的是,Python SimpleXMLRPCServer库在默认情况下不支持GET方法,所以我们需要实现它。
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
class ExtendedXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
def do_GET(self):
#only allow a request for the crossdomain file
if self.path != '/crossdomain.xml':
self.send_response(403)
self.log_request(403)
return
#open the crossdomain file and read its contents
response = open('crossdomain.xml', 'r').read()
#write the data to the socket along with valid HTTP headers
self.send_response(200)
self.send_header("Content-type", "text/xml")
self.send_header("Content-length", str(len(response)))
self.end_headers()
self.wfile.write(response)
self.log_request(200)https://stackoverflow.com/questions/233199
复制相似问题