是否可以使用 http_refer 阻止对文件夹的直接访问,同时允许 Flash 播放器访问

发布于 2024-09-12 13:30:38 字数 248 浏览 3 评论 0原文

我的服务器上有 mp3 文件,我希望通过我网站上的 Flash 播放器访问这些文件。是否可以按照密切同事的建议使用 http_refer 来执行此操作?

根据我的研究,我不断遇到下面的代码,但这会阻止包括我的 Flash 播放器在内的所有内容。 如何仅允许我的 Flash 播放器通过操作 .htaccess 文件来访问文件?

<文件*>
全部否认
< /文件>

I have mp3 files on my server that I want to be accessed via a flash player on my site. Is it possible to use http_refer to do this as suggested by a close colleage?

Based on my research, I kept coming across the code below but that blocks everything including my flash player. How do I only allow my flash player to access the files with just manipulating the .htaccess file?


< Files *>
Deny from all
< /Files>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静待花开 2024-09-19 13:30:38

使用 http_referer(原文如此)来验证任何内容都是不安全的,因为某些用户将其关闭。如果您的文件可以在网络上找到...那么,它们就可以在网络上找到。很多人花费大量时间和金钱思考如何限制音频的问题,但收效甚微。如果没有投入更多的时间,我不会对此太担心。

此外,以下是 Flash 请求 MP3 时 Firefox 发送的标头:

GET /music.mp3 HTTP/1.1
Host: myhost:80
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 GTB7.1 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive

没有任何内容将 Flash 标识为请求源。运气不好。

Using http_referer (sic) to validate anything is unsafe as some users turn this off. If your files are available on the web... well, they're available on the web. Lot's of people spend lots of time and money pondering the question of how restrict audio, to little effect. Without significantly more investment of time, I wouldn't worry to much about it.

Besides, here are the headers firefox sends when Flash requests an MP3:

GET /music.mp3 HTTP/1.1
Host: myhost:80
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 GTB7.1 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive

Nothing identifying Flash as the source of the request. Out of luck.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文