B
B
BloodVIRUS2016-11-24 13:55:14
Nginx
BloodVIRUS, 2016-11-24 13:55:14

How to give nginx only changed files?

Hello. Is it possible to send only changed files to the browser through nginx? It turns out that if the user reuploads the picture to another one, but with the same name, then the old one still lives in the cache. The cache is configured for 10 days:

location ~* ^.+\.(jpg|jpeg|gif|png|ico|bmp)$ {
        #access_log           off;
        expires                      10d;
    error_page 404 = @fallback;
        break;
    }

And only through clearing the browser cache the picture changes. Disabling caching altogether is not a good idea.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
axeax, 2016-11-24
@BloodVIRUS

If the picture got into the cache, then the browser will not request it again, the server has nothing to do with it. There is an option in the right places where the picture has changed to add to the picture address ?rnd=random_number

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question