Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

地址树试图下载/播放链接时不会传递referer,在头部添加meta标签也没用 #7915

Closed
4 tasks done
StackExplode opened this issue Jan 31, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@StackExplode
Copy link

Please make sure of the following things

  • I have read the documentation.
    我已经阅读了文档

  • I'm sure there are no duplicate issues or discussions.
    我确定没有重复的issue或讨论。

  • I'm sure it's due to AList and not something else(such as Network ,Dependencies or Operational).
    我确定是AList的问题,而不是其他原因(例如网络依赖操作)。

  • I'm sure this issue is not fixed in the latest version.
    我确定这个问题在最新版本中没有被修复。

AList Version / AList 版本

v3.42.0

Driver used / 使用的存储驱动

地址树

Describe the bug / 问题描述

我自己搭建了个服务器通过API能够对外传文件,但是为了避免滥用我加了referer检测。我尝试把此类地址挂载到Alist的地址树上,当我在Alist下载页面尝试下载或者播放视频时提示403,我当然已经把自己的alist域名加入了跨域白名单,通过Chrome Devtool发现Alist并没有传递referer:

Image

然后我就在Alist的头部设置中加入了各种meta标签,并且通过Devtool确实看到其生效了:

Image

然而,当我试图下载文件时,仍然发现其不发送referer,甚至连origin都没有。。。

可是神奇的是,我在Devtool页面中手动强制修改<meta name="referrer" content="always">此类标签比如把always改为origin后,由于alist前端是无刷新加载,我再切换到各个文件的下载页面,奇迹般的又能传referer了。

我用的chrome是125.0.6422.113版本,后来尝试换过几个浏览器,包括在安卓设备上试过,症状依旧,所以不认为是浏览器兼容性问题。

因此,我怀疑alist页面加载后是否有哪些脚本设置了referer的策略?我不懂go语言,因此无法从源码分析,还请作者大佬点拨。

Reproduction / 复现链接

本地搭建测试,暂无法分享复现连接。

Config / 配置

Image

Logs / 日志

前端问题,无需后端日志

@StackExplode StackExplode added the bug Something isn't working label Jan 31, 2025
@StackExplode
Copy link
Author

StackExplode commented Feb 4, 2025

找到问题了,我疏忽了,alist会在head后面加<meta name="referrer" content="same-origin">

Image

所以把要加的内容放在body里就有效果了。

但有的网盘检测跨域,要是能单独设置就好了。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant