Image router generates URLs for images that contain a hash of the description of that image. Those hashes are then stored in memory and retrieved when someone is requesting an image of a specific hash and size.
This works well most of the time:
- the user request an HTML document;
- the server generates a hash for the image, stores it in memory, then makes it a part of the image url,
- the server sends the image URL to the client as part of the HTML document
- the client receives the HTML
- the client requests the image by the url generated in step 3
- the server receives the request for the image, confirms that the hash is present in server's memory, and responds with an image
- the client receives the image
But there's a crucial statefulness that can make the website break in subtle ways. If the app restart between steps 4 and 5, then image-router's hash memory is cleared and it will no longer recognize that request until someone requests the HTML document first in order to put the hash in memory.
We should somehow make it more resilient. Upon request of unknown hash we could check if an image for that hash is already generated, and if so — respond with the image's content.