crossdomain.xml不受jwplayer的尊重

时间:2011-04-12 06:08:56

标签: flash crossdomain.xml

我在这个网站上有一个视频播放器 http://aiskacang.com/crawl/pseudo.html

播放器从另一个域加载flv视频文件seeon.flv。 目前,即使在seeon.flv所在的服务器中没有crossdomain.xml,视频也可以正常加载。 这不是我想要或期望的行为。

我还尝试使用以下内容放置一个crossdomain.xml:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="none"/>
</cross-domain-policy>

从firebug,我可以看到在访问视频文件之前有一个对crossdomain.xml的请求(seeon.flv)。 它使用application-type / xml的Content-type返回内容正常,但它仍然允许跨域行为。

有什么想法吗?

2 个答案:

答案 0 :(得分:0)

听起来您可能会混淆使用跨域策略。禁止跨域访问不会阻止加载和显示内容。它只是在加载和显示目标后限制来自不同域的内容之间的访问。例如,如果A.swf加载B.swf,A将无法调用B中的方法。但是B仍然会被加载。

听起来你想要的是hotlinking protection,这通常是在网络服务器级别完成的。 (也就是说,您在FLV服务器上的Apache / IIS /等中制定规则,以防止它被提供给其他域的页面。)

答案 1 :(得分:0)

为保护您的Jwplayer免受跨域文件注入,没有内置选项,crossdomain.xml对您没有帮助。

您可以尝试使用.htaccess中的服务器规则拒绝远程内容注入 http://www.masterdef.net/blog/jwplayer-crossdomain-remote-video-injection/#more-32

### Deny SWPlayer remote files access
########## Begin - File injection protection
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]
RewriteRule .* - [F]
########## End - File injection protection