fryday
fryday

Reputation: 387

How Gmail makes it?

I am developing service similar to banatag. During new feature developmnet I found unexplainable behaviour of Gmail(as I think).

I'll try to explain my question in picture:

  1. Create tag(image that I will request). Now nobody requests it

  2. Add it by URL to email. Url of image http://eggplant-tag.appspot.com/request?FT1R3WECWNTM2ZGUDXRMA8VOXJ4F6TI4

  3. There are two new AJAX requests from page, but there aren't to my domain

  4. Looking for my service. There is request from my IP, with Google User-Agent

What does request this image(tag)? I see two possibilities:

My IP:

[UPD] Add part of class that handles requests to 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'

[UPD 2]

I used wireshark to found requests to my service, but there are not any. That's why main question is how Google User Content simulate my IP address?

Upvotes: 2

Views: 591

Answers (2)

fryday
fryday

Reputation: 387

I deployed my app on my notebook, then I tried to repeat my actions.

Result confirmed my guess that Google Proxy and App Engine works together, and when Google proxy server requests my app, I see my IP.

In my experiment I saw IP of Google proxy.

Upvotes: 1

Alex Martelli
Alex Martelli

Reputation: 881625

The workings of Google Image Proxy have been thoroughly analyzed on the web, e.g at 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/ -- and the googleusercontent site is the cache/cdn used (among other things) by GIP.

The only relevance of Google App Engine might be how you've configured your app.yaml which you don't show us, i.e, is that image served as a static file, or via logic in your application code -- and, if the latter, does your code have any logging calls when it serves the image. From the limited data you show, I'd guess the former (so the file lives on, and is served by, Google's static file servers, not next to your app's code on your own instances), which would remove any mystery...

Upvotes: 8

Related Questions