Skip to content

Instantly share code, notes, and snippets.

@karlcow

karlcow/test_image.md

Last active Nov 21, 2019
Embed
What would you like to do?
Testing GitHub for images

The goal is to test what GitHub is really doing with the images.

first experiment.

Link an image

![amanite one](http://la-grange.net/tmp/amanite01.webp)

And check the markup and the server logs

<p>
    <a target="_blank"
       rel="noopener noreferrer"
       href="https://camo.githubusercontent.com/706e439b559eefecc94899ebd7d07c6f6168499f/687474703a2f2f6c612d6772616e67652e6e65742f746d702f616d616e69746530312e77656270">
        <img src="https://camo.githubusercontent.com/706e439b559eefecc94899ebd7d07c6f6168499f/687474703a2f2f6c612d6772616e67652e6e65742f746d702f616d616e69746530312e77656270"
             alt="amanite one"
             data-canonical-src="http://la-grange.net/tmp/amanite01.webp"
             style="max-width:100%;"></a></p>

Then I can see one HTTP request.

192.30.252.98 - - [21/Nov/2019:00:45:57 +0000] "GET /tmp/amanite01.webp HTTP/1.1" 200 8810 "-" "github-camo (876de43e)"

A reload of the page didn't create any HTTP requests on the origin server, but github replied with a 304 Not Modified.

HTTP/1.1 304 Not Modified
Date: Thu, 21 Nov 2019 00:52:28 GMT
Via: 1.1 varnish
Cache-Control: public, max-age=31536000
Expires: Thu, 28 Nov 2019 00:45:57 GMT
Age: 349
Connection: keep-alive
X-Served-By: cache-hnd18734-HND
X-Cache: HIT
X-Cache-Hits: 1
X-Timer: S1574297548.398821,VS0,VE1
Vary: Accept-Encoding
X-Fastly-Request-ID: 0527f2da6b384f3993ea5c48b9dfad00bd2c5f46
Timing-Allow-Origin: https://github.com

A shift reload created a second request on the origin server.

192.30.252.98 - - [21/Nov/2019:00:55:22 +0000] "GET /tmp/amanite01.webp HTTP/1.1" 200 8810 "-" "github-camo (876de43e)"
HTTP/1.1 200 OK
Content-Type: image/webp
Cache-Control: public, max-age=31536000
Content-Security-Policy: default-src 'none'; img-src data:; style-src 'unsafe-inline'
Expires: Thu, 28 Nov 2019 00:55:22 GMT
Last-Modified: Thu, 21 Nov 2019 00:16:55 GMT
Server: github-camo (876de43e)
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block
X-GitHub-Request-Id: 5338:49F8:B5E0B:C4313:5DD5E0A3
Content-Length: 8810
Accept-Ranges: bytes
Date: Thu, 21 Nov 2019 00:56:04 GMT
Via: 1.1 varnish
Age: 0
Connection: keep-alive
X-Served-By: cache-tyo19926-TYO
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1574297764.109975,VS0,VE345
Vary: Accept-Encoding
X-Fastly-Request-ID: 7d2cdc504617bf3274b02db5b35b5b318ff857be
Timing-Allow-Origin: https://github.com

second experiment

On the server, let's change the image.

cp amanite02.webp amanite01.webp

A reload doesn't change the image. There is no request to the HTTP server.

HTTP/1.1 304 Not Modified
Date: Thu, 21 Nov 2019 01:01:00 GMT
Via: 1.1 varnish
Cache-Control: public, max-age=31536000
Expires: Thu, 28 Nov 2019 00:55:22 GMT
Age: 296
Connection: keep-alive
X-Served-By: cache-tyo19942-TYO
X-Cache: HIT
X-Cache-Hits: 2
X-Timer: S1574298060.158992,VS0,VE0
Vary: Accept-Encoding
X-Fastly-Request-ID: 2f361d717cbf4bdb51dfcc2f0f92045f66e357fa
Timing-Allow-Origin: https://github.com

Even a shift reload doesn't refresh the image in the comment. There is a 200, but no http request to the server.

@karlcow

This comment has been minimized.

Copy link
Owner Author

@karlcow karlcow commented Nov 21, 2019

First test

amanite one

@karlcow

This comment has been minimized.

Copy link
Owner Author

@karlcow karlcow commented Nov 21, 2019

Posting here amanite 2 as a reference

amanite two

@karlcow

This comment has been minimized.

Copy link
Owner Author

@karlcow karlcow commented Nov 21, 2019

The first image should be identical to the second image.

Capture d’écran 2019-11-21 à 10 11 24

@miketaylr

This comment has been minimized.

Copy link

@miketaylr miketaylr commented Nov 21, 2019

Here is what I see:

Screen Shot 2019-11-20 at 7 13 55 PM

@karlcow

This comment has been minimized.

Copy link
Owner Author

@karlcow karlcow commented Nov 21, 2019

Ah interesting!
Thanks @miketaylr

on my side I still see them as different. Browser caching maybe.
And I have seen your request on my server.

@karlcow

This comment has been minimized.

Copy link
Owner Author

@karlcow karlcow commented Nov 21, 2019

In a different browser (no caching for this page), I entered the URL and still different images.

@karlcow

This comment has been minimized.

Copy link
Owner Author

@karlcow karlcow commented Nov 21, 2019

I deleted the image and it is still being served by github even after shift reload.
So the image really lives in the github caching systems.

Expires: Thu, 28 Nov 2019 01:12:42 GMT

to check if the image has disappeared from their caching system.

@karlcow

This comment has been minimized.

Copy link
Owner Author

@karlcow karlcow commented Nov 21, 2019

Also the

             data-canonical-src="http://la-grange.net/tmp/amanite01.webp"

is not used by any JavaScript in the page. This is "only cosmetics" informational.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.