cross-domain - 如何跨子域保留引荐来源网址(Referer HTTP 标头)?
问题描述
我有一个网站正在运行,www.example.com
它发出 GET 请求api.example.com
来处理表单。当我检查网络服务器日志时,api.example.com
我看到来自 Safari 的请求获得了完整的引用(例如www.example.com/page-where-request-originated)。但是来自 Chrome 的请求只能获得部分引用(www.example.com)。
当请求命中时,我需要能够跟踪完整的引用页面api.example.com
。查看Referrer-Policy 的文档,似乎我唯一的选择是将其设置为unsafe-url
. 但这似乎有点过头了,因为我只希望为example.com
. 那可能吗?
解决方案
我能找到的唯一选择是strict-origin
:Send the origin as referrer, but only when the request is no downgrade from https to http
。
见:https ://wiki.crashtest-security.com/enable-security-headers
其他所有内容要么完全省略引荐来源网址,要么发送不带任何 URL 参数的原始 URL。
推荐阅读
- java - 我可以得到帮助来解决这个问题吗?
- powerapps - 日期功能不适用于 PowerApps 中的标签
- java - Java - 未为 do-while 循环初始化变量
- python - 向 matplotlib 中的图形添加文本
- typescript - 为我选择的每个项目设置样式?
- javascript - Gmail Add On Google Script 行为不正确
- regex - JS 正则表达式仅排除 http - 必须包含 https
- javascript - 如何在调用按键后隐藏以前的问题时显示新问题
- python - tkinter askdirectory 在导入的模块中不起作用
- mysql - 如何在 NodeJS 中使用变量插入查询