← Back to context

Comment by pqdbr

7 days ago

Congrats on launching!

Curious how the dynamic image works in the e-mail signature: AFAIK, Gmail and others heavily cache any images inside e-mail, so even if the image changes, Gmail will be displaying the online/offline cached image, not the most up-to-date one.

You can overcome this using headers, which instructs Gmail not to cache. Snippet:

response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"

response.headers["Pragma"] = "no-cache"

response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"

  • You might want to investigate this further - IIRC a lot of email services retrieve images in advance server side to avoid leaking whether the client has interacted with the email. I might be mistaken here.