HTTP 引荐来源网址陷阱?
我需要确保我的网页始终位于第三方拥有的 iframe 内。 该第三方使用 src="../index.php" 引用我们的登陆页面。
现在我的问题是,如果我使用引荐来源网址来确保该页面是由我自己或第三方请求的,并且如果不强制重新加载第 3 方网站,是否有我应该注意的重大问题?
例如,是否有某些常见浏览器不遵循引用规则?
谢谢。
I need to ensure that my webpage is always within an iframe owned by a 3rd party. This third party refers to our landing page using src="../index.php".
Now my question is, if I make use of referrer to ensure that the page was requested by either myself or from the third party and if not force a reload of the 3rd party site, are there any big gotchas I should be aware of?
For example, are there certain common browsers that don't follow the referrer rules?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
另外,它是
REFERER
因为它在规范中不知何故拼写错误。 这是我的第一个REFERER
问题。Also, it's
REFERER
because it somehow got misspelled in the spec. That was my very firstREFERER
gotcha.您可以执行此操作的唯一方法是直接授权请求,因为引用者操纵。
如果您想宽松,或者要求包含的客户端,您可以将请求限制为一组IP地址/system 对于 iframe 中显示的请求有一个身份验证 cookie。
祝你好运
The only way you could do this is to directly authorize the request because of referrer manipulation..
You could restrict requests to a set of IP addresses, if you want to be lax, or require that the including client/system has an authentication cookie for requests shown in the iframe.
Good Luck
不需要推荐人。 如果浏览器不提供它,那么您将陷入无限的重定向循环。 Referrer 实际上是“自愿的”,就像 cookies、java 和 javascript 一样。
虽然。 您可以保留 IP 和 IP 的日志。 最后重定向的时间。 删除超过 5 分钟的日志,并且每 5 分钟重定向一次以上。 您应该捕获 99.9% 的用户,但避免其余用户出现无限重定向循环。 日志不能依赖于浏览器中的任何内容(这是最初的问题),因此没有 cookie 也没有会话。 一个简单的 2 列数据库表就足够了。
Referrers are not required. If a browser doesn't supply it then you'll get yourself into an endless redirect loop. Referrer is effectively "voluntary" just like cookies, java, and javascript.
Although. You could keep a log of IP & time last redirected. Prune the logs for anything over 5 minutes old and never redirect more than once per 5 minutes. You should catch 99.9% of users out there but avoid an infinite redirect loop for the rest. The log cannot rely on anything in the browser (that's the original problem) so no cookie and no session. A simple 2-column database table should suffice.
由于引用者欺骗,您不能使用引用者来“确保”网页始终从其他地方调用。
You can't use referrer to "ensure" that the webpage is always being called from somewhere else because of referrer spoofing.
即使是众所周知的格式也可能会改变......
谷歌显然已经改变了它的引用网址。 2009 年 4 月 14 日,Google.com 即将发生的变化搜索推荐; Google Analytics(分析)不受影响:
另请参阅 Google 正在将其引用网址从 /search 更改为 /url .任何已知问题?)
Even well-known formats may change...
Google apparently has changed its referrer URL. April 14, 2009, An upcoming change to Google.com search referrals; Google Analytics unaffected:
(See also Google is changing its referrer URLs from /search into /url. Any known issues?)
请注意,每当用户通过 JavaScript 导航到链接时,Internet Explorer(所有版本)都会专门省略 HTTP REFERRER。 (错误报告)
例如
Be aware that Internet Explorer (all versions) specifically OMITS the HTTP REFERRER whenever a user navigates to a link as a result of JavaScript. (bug report)
e.g.