A
A
Alexey Bugaev2020-03-11 21:34:28
Apache HTTP Server
Alexey Bugaev, 2020-03-11 21:34:28

Why doesn't max-age change in cache-control?

I experimented with max-age values ​​on hosting, setting different values. As a result, I decided, but the cache-control value stuck to 4 files: max-age=31536000, public I set the values ​​\u200b\u200bthrough .htaccess in it now, for the experiment, I set the following time for all files:

Header set Cache-Control "max-age=888 , private"

Applied to all project files except for 4 images.
I reuploaded the pictures, renamed them, even uploaded completely different ones with different names and still there: max-age=31536000, public. Does anyone know why this is happening?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Shinkevich, 2020-03-11
@domres

This is how I twisted it...

<FilesMatch "\.(html|htm|shtml)$">
    Header set Cache-Control "private max-age=259200, must-revalidate"
</FilesMatch>


<FilesMatch "\.(css|js|jpg|jpeg|gif|png|ico|cur|swf|woff|ttf|eot|webp|svg)$">
    Header set Cache-Control "private max-age=15552000, must-revalidate"
</FilesMatch>

<FilesMatch "\.(pdf|doc|docx|xls|rtf|zip|gzip|bzip|rar)$">
    Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
</FilesMatch>

But I have an Apache + NGINX bundle, so the nginx virtual host config (you may not have access to it, I don’t have hosting, but my own server with several virtual hosts) also says this:
location ~* ^.+\.(css|js)$ {
      root     "%hostdir%";
      rewrite ^(.+)\.(\d+)\.(css|js)$ $1.$3 last;
      expires  365d;
    }
  
    location ~* ^.+\.(jpg|jpeg|gif|png|ico|cur|swf|woff|ttf|eot|webp|svg)$ {
      root     "%hostdir%";
      expires  365d;
    }
  
  location ~* ^.+\.(pdf|doc|docx|xls|rtf|zip|gzip|rar|bzip)$ {
       root     "%hostdir%";
       expires off;
  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question