HTTP 引荐来源网址是什么?

发布于 2024-08-06 21:27:26 字数 275 浏览 4 评论 0原文

在以下情况下,HTTP 引荐来源网址是什么:

  1. 用户单击网站上的链接,然后到达另一个网站,该网站正在热链接来自第三个网站的图像,图像上的引荐来源网址是什么。
  2. 用户单击转到另一个网站的链接,该网站使用 META Refresh 将其发送回第一个网站。
  3. 用户单击转到另一个网站的链接,该网站包含指向第二个网站第二个页面的 iframe,引荐来源网址是原始网站还是第二个网站?

我似乎找不到答案,如果我在这里找不到答案,那么我只会制作页面并进行测试。

What would the HTTP referrer be in the following cases:

  1. User clicks a link on a website and arrives at a different website that is hot linking an image from a 3rd website, what would the referrer be on the image.
  2. User clicks a link that goes to a different website that uses META Refresh to send them back to the first website.
  3. User clicks a link that goes to a different website which contains an iframe to a second page on the second site, is the referrer the original site or the second site?

I cant seem to find an answer, If I cant get an answer here then i'll just make the pages and test it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

黯然#的苍凉 2024-08-13 21:27:26

我懒得尝试解释所有给定的场景,但为了帮助测试,我们可以轻松创建一个 PHP 脚本来返回一张图像,告诉我们引荐来源网址是什么:

<?php
  header("Content-type: image/png");
  header("Cache-control: no-cache");
  header("Pragma: no-cache");
  header("Expires: -1");

  $s = "Referrer: " . $_SERVER['HTTP_REFERER'];

  $im = @imagecreate(500, 13)
    or die("Cannot Initialize new GD image stream");
  $black = imagecolorallocate($im, 0, 0, 0);
  imagecolortransparent($im, $black);
  $red = imagecolorallocate($im, 255, 0, 0);
  imagestring($im, 3, 0, 0, $s, $red);
  imagepng($im);
  imagedestroy($im);
?>

如果网站使用 HTTP 重定向进行响应,例如 302 暂时移动,那么您的浏览器仍会发送带有重定向请求的原始引荐来源网址:

<?php
  header("Location: http://[..]/referrer-to-img/referrer.php?redirected");
?>

请注意,例如在 Mac 上的 Safari 中,按住 Command 键单击(可在新选项卡)并按住 Command-Option 键单击(新窗口) 设置该链接的引荐来源网址,同时从上下文菜单中选择“在新选项卡/窗口中打开链接”(右键单击后) )

快乐测试。 ;-)

I am too lazy to try to interpret all given scenarios, but to help test things one can easily created a PHP script to return an image that tells us what the referrer is:

<?php
  header("Content-type: image/png");
  header("Cache-control: no-cache");
  header("Pragma: no-cache");
  header("Expires: -1");

  $s = "Referrer: " . $_SERVER['HTTP_REFERER'];

  $im = @imagecreate(500, 13)
    or die("Cannot Initialize new GD image stream");
  $black = imagecolorallocate($im, 0, 0, 0);
  imagecolortransparent($im, $black);
  $red = imagecolorallocate($im, 255, 0, 0);
  imagestring($im, 3, 0, 0, $s, $red);
  imagepng($im);
  imagedestroy($im);
?>

If a web site responds with a HTTP redirect, like 302 Moved Temporarily, then your browser will still send the original referrer with the redirected request:

<?php
  header("Location: http://[..]/referrer-to-img/referrer.php?redirected");
?>

Please note that, for example in Safari on a Mac, Command-click (to open a link in a new tab) and Command-Option-click (new window) do set the referrer for that link, while choosing "Open Link in New Tab/Window" from the context menu (after a right-click) does not.

Happy testing. ;-)

若言繁花未落 2024-08-13 21:27:26

Referer始终是引用当前资源的文档/资源。因此:

  1. 热链接图像的文档的 URL。
  2. 与 HTTP 重定向不同,META 刷新将调用浏览器发送 META 刷新文档的 URL > 位于其中。
  3. 就像图像一样,Referer 将是包含该框架的文档的 URL。

The Referer is always the document/resource that is referring to the current resource. So:

  1. The URL of the document the image is hot-linked in.
  2. Different from HTTP redirects, a META refresh will invoke the browser to send the URL of the document the META refresh is in.
  3. Just like the image, the Referer will be the URL of the document that contains the frame.
莫言歌 2024-08-13 21:27:26
  1. 引荐来源网址将是第三个网站。

    <块引用>

    引荐来源网址始终是 HTTP 请求的主机。

  2. 引荐来源网址将是不同的网站。

    <块引用>

    即使页面使用元刷新,它仍然是一个 HTTP 请求,并且之前的规则适用。

  3. 引荐来源网址将是第二个网站。

    <块引用>

    iframe 请求的处理方式与新浏览器窗口中的请求相同。

  1. The referrer would be the third website.

    The referrer is always the host of the HTTP request.

  2. The referrer would be the different website.

    Even though the page uses a meta refresh it is still an HTTP request and the previous rule applies.

  3. The referrer would be the second website.

    iframe requests are treated just like requests in new browser windows.

许你一世情深 2024-08-13 21:27:26

首先,HTTP Referer 可能是各种隐私感知软件客户端甚至某些网关/代理上可能会变成的任何东西。
让我来尝试一下:

1. That of the second web site
2. That of the second web site
3. pretty sure (not certain) but the second site still seems to be the right response.

无论浏览器发送请求时当前页面是什么(无论是图像、重定向还是其他),[通常]都会发送到该 URL 下的服务器。要求。 [再次强调,如果没有某种隐私设备更改此 HTTP 标头值和其他 HTTP 标头值]

First off, HTTP Referer may be just about anything which various privacy-aware software client-side or even on some gateway/proxy on the way may turn it to be.
Yet let me take a crack at it:

1. That of the second web site
2. That of the second web site
3. pretty sure (not certain) but the second site still seems to be the right response.

Whatever the current page is at the time the browser sends a request (be it for an image, a redirection, whatever) is [normally] sent to the server underlying the URL of the request. [again, if no privacy device of sorts change this and other HTTP header values]

静谧幽蓝 2024-08-13 21:27:26

猜测,但我非常有信心:

  1. 第三个网站会将第二个网站视为引荐来源网址。
  2. 第一个网站将引用者视为第二个网站
  3. 第二个网站。

Guesses, but I'm pretty confident:

  1. Third website would see the second site as the referer.
  2. First website sees referer as second web site
  3. Second site.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文