Борьба с кэшем

This commit is contained in:
FrigaT
2026-04-21 21:43:05 +03:00
parent d2df57ca6e
commit 64cc0e68a1
3 changed files with 14 additions and 4 deletions

View File

@@ -5,6 +5,12 @@ events {
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Не раскрывайть версию Nginx в ответах.
server_tokens off;
# Ограничение запросов от одного IPадреса, чтобы предотвратить DDoSатаки и злоупотребление ресурсами.
limit_req_zone $binary_remote_addr zone=one:10m rate=60r/s;
# Сжатие
gzip on;
@@ -20,6 +26,8 @@ http {
# Для Service Worker запрещаем кэширование, чтобы он всегда был свежим
location = /service-worker.js {
etag off;
add_header Last-Modified "";
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
@@ -28,6 +36,8 @@ http {
# Для файла манифеста Service Worker assets тоже не кэшируем
location = /service-worker-assets.js {
etag off;
add_header Last-Modified "";
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
@@ -36,6 +46,8 @@ http {
# Для файла index.html тоже не кэшируем
location = /index.html {
etag off;
add_header Last-Modified "";
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";