【问题标题】:How to preserve referrer (Referer HTTP header) across subdomains?如何跨子域保留引荐来源网址(Referer HTTP 标头)?
【发布时间】:2021-05-11 11:13:44
【问题描述】:

我有一个在www.example.com 上运行的网站,它向api.example.com 发出GET 请求以处理表单。当我检查 api.example.com 的 Web 服务器日志时,我看到来自 Safari 的请求获得了完整的引用(例如,www.example.com/page-where-request-originated)。但是来自 Chrome 的请求只能获得部分引用 (www.example.com)。

当请求到达api.example.com 时,我需要能够跟踪完整的引荐页面。查看documentation for Referrer-Policy 似乎我唯一的选择是将其设置为unsafe-url。但这似乎有点矫枉过正,因为我只希望为example.com 的子域发送引荐来源网址。这可能吗?

【问题讨论】:

    标签: cross-domain referrer referrer-policy


    【解决方案1】:

    我能找到的唯一选项是 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。

    【讨论】:

      猜你喜欢
      • 2011-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-03
      • 1970-01-01
      • 2010-10-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多