Борьба с кэшем
This commit is contained in:
@@ -6,6 +6,12 @@ http {
|
|||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type application/octet-stream;
|
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;
|
gzip on;
|
||||||
gzip_vary on;
|
gzip_vary on;
|
||||||
@@ -20,6 +26,8 @@ http {
|
|||||||
|
|
||||||
# Для Service Worker – запрещаем кэширование, чтобы он всегда был свежим
|
# Для Service Worker – запрещаем кэширование, чтобы он всегда был свежим
|
||||||
location = /service-worker.js {
|
location = /service-worker.js {
|
||||||
|
etag off;
|
||||||
|
add_header Last-Modified "";
|
||||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||||
add_header Pragma "no-cache";
|
add_header Pragma "no-cache";
|
||||||
add_header Expires "0";
|
add_header Expires "0";
|
||||||
@@ -28,6 +36,8 @@ http {
|
|||||||
|
|
||||||
# Для файла манифеста Service Worker assets – тоже не кэшируем
|
# Для файла манифеста Service Worker assets – тоже не кэшируем
|
||||||
location = /service-worker-assets.js {
|
location = /service-worker-assets.js {
|
||||||
|
etag off;
|
||||||
|
add_header Last-Modified "";
|
||||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||||
add_header Pragma "no-cache";
|
add_header Pragma "no-cache";
|
||||||
add_header Expires "0";
|
add_header Expires "0";
|
||||||
@@ -36,6 +46,8 @@ http {
|
|||||||
|
|
||||||
# Для файла index.html – тоже не кэшируем
|
# Для файла index.html – тоже не кэшируем
|
||||||
location = /index.html {
|
location = /index.html {
|
||||||
|
etag off;
|
||||||
|
add_header Last-Modified "";
|
||||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||||
add_header Pragma "no-cache";
|
add_header Pragma "no-cache";
|
||||||
add_header Expires "0";
|
add_header Expires "0";
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
"short_name": "PlaylistShare",
|
"short_name": "PlaylistShare",
|
||||||
"id": "./",
|
"id": "./",
|
||||||
"start_url": "./",
|
"start_url": "./",
|
||||||
|
"scope": "./",
|
||||||
|
"handle_links": "preferred",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"background_color": "#1a1a27",
|
"background_color": "#1a1a27",
|
||||||
"theme_color": "#7e6fff",
|
"theme_color": "#7e6fff",
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ const baseUrl = new URL(base, self.origin);
|
|||||||
const manifestUrlList = self.assetsManifest.assets.map(asset => new URL(asset.url, baseUrl).href);
|
const manifestUrlList = self.assetsManifest.assets.map(asset => new URL(asset.url, baseUrl).href);
|
||||||
|
|
||||||
async function onInstall(event) {
|
async function onInstall(event) {
|
||||||
console.info('Service worker: Install');
|
|
||||||
|
|
||||||
self.skipWaiting();
|
self.skipWaiting();
|
||||||
|
|
||||||
// Fetch and cache all matching items from the assets manifest
|
// Fetch and cache all matching items from the assets manifest
|
||||||
@@ -30,8 +28,6 @@ async function onInstall(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onActivate(event) {
|
async function onActivate(event) {
|
||||||
console.info('Service worker: Activate');
|
|
||||||
|
|
||||||
await self.clients.claim();
|
await self.clients.claim();
|
||||||
|
|
||||||
// Delete unused caches
|
// Delete unused caches
|
||||||
|
|||||||
Reference in New Issue
Block a user