LINUX.ORG.RU
ФорумAdmin

В чем разница между mod_expires и mod_headers при установке cache?

 ,


0

1

Как я понял и тот и этот отправляют браузеру настройки кеширования (время жизни кеша) на стороне клиента?

Если так, то у mod_headers больше гибкости и присутствует возможность указания дополнительных парметров private,public и др. Лучше использовать его?

Вопрос навеян тем, что на некоторых сайтах с инструкциями по кешированию, предлагается ставить настройки сразу для обоих модулей. Я в этом не вижу смыла. Правильно ли я рассуждаю?

# Cache-Control
<ifModule mod_headers.c>
# 30 дней
<filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
# 30 дней
<filesMatch "\.(css|js)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
# 2 дня
<filesMatch "\.(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</filesMatch>
# 1 день
<filesMatch "\.(html|htm|php)$">
Header set Cache-Control "max-age=172800, private, must-revalidate"
</filesMatch>
</ifModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access 7 days"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/html "access plus 7 day"
ExpiresByType text/x-javascript "access 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/x-shockwave-flash "access 1 year"
</IfModule>

фронтенд типа nginx совсем не используется?
было бы проще повесить отдачу статики и заголовки кеширования на него

xtraeft ★★☆☆
()
Ответ на: комментарий от xtraeft

Пока нет, просто хотелось бы уяснить для себя этот момент на данном этапе.

drunkmad
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.