-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnginx.web.conf
More file actions
66 lines (54 loc) · 1.9 KB
/
Copy pathnginx.web.conf
File metadata and controls
66 lines (54 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript application/wasm;
gzip_min_length 256;
# Block access to dotfiles (.env, .git, etc.)
location ~ /\. {
deny all;
return 404;
}
# favicon.ico fallback to favicon.png
location = /favicon.ico {
try_files /favicon.ico /favicon.png =404;
}
# Never cache entry points (so Cloudflare always revalidates after deploy)
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
}
location = /flutter_service_worker.js {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
}
location = /flutter_bootstrap.js {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
}
location = /main.dart.js {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
}
location = /version.json {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
}
location = /manifest.json {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
}
# Cache static assets with content hashes (fonts, images, canvaskit)
# Excludes .js since main.dart.js has no content hash in its filename
location ~* \.(css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|wasm)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Flutter web SPA - all routes go to index.html
location / {
try_files $uri $uri/ /index.html;
}
}