我的 django 应用程序可以充当标头剥离代理吗?
公共 Soundcloud 曲目 url 通过利用 Content-Disposition 标头(我认为..)在浏览到它们时强制下载,这会触发已知 mime 类型的下载。有没有办法代理(为其创建直通)这些网址并从我的请求中删除此标头。我想避免自己提供 mp3,但我不想触发下载。
Public Soundcloud track urls force a download upon browsing to them by utilizing a Content-Disposition header (I think.. ) which triggers a download for a known mime-type. Is there a way to proxy (create a passthrough for) these urls and strip this header from my request. I want to avoid serving the mp3 myself but I don't want to trigger a download.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从技术上讲,您完全有可能从服务器请求文件并将传入数据连接到您视图中的输出流响应,从而允许您控制客户端浏览器接收的标头,以便它不会要求它们保存文件。
但出于几个原因,我会建议不要这样做。
Technically it is entirely possible that you could request the file from the server and connect that incoming data to an output stream response in your view, thereby allowing you to control the headers that your client's browser receives so that it does not ask them to save the file.
I'm going to recommend against this though for a couple of reasons.
我认为这是不可能的。它应该已经完全取决于浏览器。例如,Opera 会要求用户天气来打开或下载。
您可以使用其嵌入代码将它们嵌入到您的网站中。
编辑:
不,您甚至无法使用标题提供的链接,因为它们已经解决了热链接问题。每次下载都与浏览器/会话相关联,因此您无法存储 mp3 的真实 URL 和链接。
I don't think it's possible. It should already be entirely up to the browser. For example Opera asks user weather to open it or download.
You could embed them in your site using their Embeded Code.
EDIT:
Nope you can't even use the link provided by the header since they've worked around hotlinking. Each download is associated to the browser/session so you can't store the real url for the mp3 and link to that.