freedit-org / freedit

The safest and lightest forum, powered by rust.
https://freedit.eu
MIT License
215 stars 21 forks source link

On uploading/replacing avatars #171

Closed kpishere closed 9 months ago

kpishere commented 10 months ago

When you upload an avatar for a user, there is no cache flush on your browser so that new avatar does not take effect.

This happens when one is replacing the avatar with a new one.

freedit-dev commented 10 months ago

https://freedit.eu/post/1/5

Are you testing on local machine or behind Cloudflare? If behind Cloudflare, you need to change the default cache setting from 4 hours to respect existing headers

freedit-dev commented 10 months ago

I just dig this issue again and found that CDNs like Cloudflare do not respect header last-modified(Stackoverflow).

So just add (starts_with(http.request.uri.path, "/static/avatars/")) or (starts_with(http.request.uri.path, "/static/inn_icons/")) this rule in Cloudflare Caching/Cache Rules