如何保护 MP3 url?
How do I secure an MP3 url?
我正在制作一个音乐网站,我可以在其中播放免费音乐,但我不想让用户从我的服务中下载 mp3 文件。
我使用 laravel v5.4 框架作为后端,anguler v5.5 作为前端和 mp3 音乐播放器我使用 html5。
我的应用程序工作得很好。 UI 没有人找不到任何 mp3 url,但是
当我打开浏览器开发者工具和存储检查器 -> 本地存储时,我在那里看到了完整的 mp3 url。
我在互联网上可以找到任何可以隐藏 mp3 url 或在用户找不到 url 或直接从 url 下载 mp3 的地方保护它们的解决方案。
有人知道吗?
来自the docs:
For files stored using the s3
or rackspace
driver, you may create a temporary URL to a given file using the temporaryUrl
method. This method accepts a path and a DateTime instance specifying when the URL should expire:
$url = Storage::temporaryUrl(
'file1.jpg', now()->addMinutes(5)
);
如果您不使用这些服务之一来存储文件,则需要手动创建临时 URL。
您可以通过设置 S3 的存储桶策略来保护轨道。
示例:
{
"Id": "Policy10197062190400",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1597062199047",
"Action": [
"s3:GetObject"
],
"Effect": "Deny",
"Resource": "arn:aws:s3:::My-project/*",
"Condition": {
"StringNotLike": {
"aws:Referer": "http:MyDomain/"
}
},
"Principal": "*"
}
]
}
您可以限制只为MyDomain
提供音乐。
我正在制作一个音乐网站,我可以在其中播放免费音乐,但我不想让用户从我的服务中下载 mp3 文件。
我使用 laravel v5.4 框架作为后端,anguler v5.5 作为前端和 mp3 音乐播放器我使用 html5。
我的应用程序工作得很好。 UI 没有人找不到任何 mp3 url,但是
当我打开浏览器开发者工具和存储检查器 -> 本地存储时,我在那里看到了完整的 mp3 url。
我在互联网上可以找到任何可以隐藏 mp3 url 或在用户找不到 url 或直接从 url 下载 mp3 的地方保护它们的解决方案。
有人知道吗?
来自the docs:
For files stored using the
s3
orrackspace
driver, you may create a temporary URL to a given file using thetemporaryUrl
method. This method accepts a path and a DateTime instance specifying when the URL should expire:
$url = Storage::temporaryUrl(
'file1.jpg', now()->addMinutes(5)
);
如果您不使用这些服务之一来存储文件,则需要手动创建临时 URL。
您可以通过设置 S3 的存储桶策略来保护轨道。
示例:
{
"Id": "Policy10197062190400",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1597062199047",
"Action": [
"s3:GetObject"
],
"Effect": "Deny",
"Resource": "arn:aws:s3:::My-project/*",
"Condition": {
"StringNotLike": {
"aws:Referer": "http:MyDomain/"
}
},
"Principal": "*"
}
]
}
您可以限制只为MyDomain
提供音乐。