简体   繁体   English

建议:使用CloudFlare和Ghost跟踪HTTP请求

[英]Advise: Tracking HTTP requests with CloudFlare and Ghost

I have a very interesting requirement that I am not too sure of the answer. 我有一个非常有趣的要求,我不太确定答案。 I am turning to Stack Overflow in the hope that someone is able to share their experiences and propose a solution. 我转向Stack Overflow,希望有人能够分享他们的经验并提出解决方案。

Setup 设定

I have a front facing website that is powered by Ghost running a standard MEAN stack enviorment and all traffic is handled via CloudFlare . 我有一个前端网站,由运行标准MEAN堆栈环境的Ghost提供支持,所有流量都通过CloudFlare处理。

Problem 问题

I have become aware recently that I have been receiving a large amount of requests via the CloudFlare display that do not appear in my Google Analytics. 我最近意识到我通过CloudFlare显示收到了大量请求,这些请求未出现在我的Google Analytics中。 I am aware that some people may have JS disabled, however we are talking orders of magnitude difference between the two. 我知道有些人可能会禁用JS,但我们正在谈论两者之间的数量级差异。 I would very much like to know why. 我非常想知道为什么。

Hypothesis 假设

I suspect that person(s) are trying to use port scanning, or attempt to find vulnerabilities in my platform. 我怀疑那些人正在尝试使用端口扫描,或者试图在我的平台中查找漏洞。 Or it could be a simple case of linking going astray. 或者它可能是一个简单的连接误入歧途的情况。 Either way, I am not sure. 无论哪种方式,我都不确定。

Solutions 解决方案

This is the part I am not sure about. 这是我不确定的部分。 What would be the best approach to record and retain HTTP requests? 记录和保留HTTP请求的最佳方法是什么? One consideration I have had is to use Morgan to to filestream requests into a .log file and review at a later date. 我考虑过的一个考虑因素是使用Morgan将请求文件传输到.log文件中并在以后查看。 However, I wonder if there is a more elegant solution. 但是,我想知道是否有更优雅的解决方案。

I welcome any thoughts you may have. 我欢迎您的任何想法。

Thanks 谢谢

Google Analytics is a fair bit more conservative than Cloudflare. Google Analytics比Cloudflare更保守。 One reason, as you mentioned is that Cloudflare is able to access raw HTTP logs, instead of having to use JavaScript to identify page views. 正如您所提到的,一个原因是Cloudflare能够访问原始HTTP日志,而不必使用JavaScript来识别页面视图。 As Cloudflare only marks HTTP requests, port scanning would not be recorded as a hit. 由于Cloudflare仅标记HTTP请求,因此端口扫描不会记录为命中。

However, even with bots accounted for, Cloudflare may still record views which Google Analytics can't, for example; 但是,即使考虑到机器人,Cloudflare仍可能记录Google Analytics无法查看的视图,例如; AJAX content requests. AJAX内容请求。 As the Google Analytics beacon is only run once when the page is loaded, Google Analytics only records this once - Cloudflare sees this as 2 HTTP requests in it's raw logs. 由于Google Analytics信标仅在加载页面时运行一次,因此Google Analytics只记录一次 - Cloudflare将其视为原始日志中的2个HTTP请求。

For details, please see the following blog post, it goes into detail as to how Google Analytics and Cloudflare Analytics can differ: Understanding Analytics: When Is a Page View Not a Page View? 有关详细信息,请参阅以下博客文章,详细了解Google Analytics和Cloudflare Analytics如何区别: 了解Google Analytics:何时页面视图不是页面视图?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM