Gmail 是如何做到的?

How Gmail makes it?

我正在开发类似于banatag的服务。在新功能 developmnet 期间,我发现了 Gmail 无法解释的行为(正如我所想)。

我将尝试在图片中解释我的问题:

  1. 创建标签(我将请求的图像)。现在没人要求了

  2. 通过 URL 添加到电子邮件。 Url 个图像 http://eggplant-tag.appspot.com/request?FT1R3WECWNTM2ZGUDXRMA8VOXJ4F6TI4

  3. 页面有两个新的 AJAX 请求,但我的域没有

  4. 正在寻找我的服务。有请求 来自我的 IP,使用 Google User-Agent

这张图片(标签)有什么要求? 我看到两种可能性:

我的IP:

[更新] 添加处理请求的 class 部分到 image(tag):

...
request.remoteAddress = str(self.request.remote_addr)# save remote address
request.put()
...
self.response.write(simpleImageData) #write to body binary data of 1x1 transparent image
self.response.headers[ 'Content-Type' ] = 'image/png'
self.response.headers[ 'Cache-Control' ] = 'no-cache, no-store, must-revalidate'
self.response.headers[ 'Pragma' ] = 'no-cache'
self.response.headers[ 'Expires' ] = '0'

[更新 2]

我使用 wireshark 找到了对我的服务的请求,但没有任何请求。这就是为什么主要问题是 Google 用户内容如何模拟我的 IP 地址?

Google Image Proxy 的工作原理已在网络上进行了彻底的分析,例如 https://litmus.com/blog/gmail-adds-image-caching-what-you-need-to-know and https://blog.filippo.io/how-the-new-gmail-image-proxy-works-and-what-this-means-for-you/ -- googleusercontent 站点是 cache/cdn 使用的(除其他外) GIP.

Google App Engine 的唯一相关性可能是您如何配置您的 app.yaml,但您没有向我们展示,即该图像是作为静态文件提供的,还是通过您的应用程序代码中的逻辑——如果是后者,您的代码在提供图像时是否有任何日志记录调用。根据您显示的有限数据,我猜想是前者(因此文件存在于 Google 的静态文件服务器上并由其提供服务,而不是在您自己的实例上的应用程序代码旁边),这将消除任何神秘感...

我在我的笔记本上部署了我的应用程序,然后我尝试重复我的操作。

结果证实了我的猜测 Google 代理和 App Engine 一起工作,当 Google 代理服务器请求我的应用程序时,我看到了我的 IP。

在我的实验中,我看到了 Google 代理的 IP。