Files
flutter/nginx.conf
T
Ruslan Bakiev 0a852edc35
Build and deploy Flutter Web / build (push) Failing after 5m32s
Fix web cache and service worker handoff
2026-06-22 16:21:02 +07:00

104 lines
2.7 KiB
Nginx Configuration File

server {
listen 80;
server_name _;
gzip on;
gzip_comp_level 6;
gzip_min_length 1024;
gzip_vary on;
gzip_types
application/javascript
application/json
application/manifest+json
application/wasm
image/svg+xml
text/css
text/plain;
etag on;
root /usr/share/nginx/html;
index index.html;
client_max_body_size 25m;
location = /index.html {
add_header Cache-Control "no-cache" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
try_files /index.html =404;
}
location ~* ^/(bootstrap\.js|sw\.js)$ {
add_header Cache-Control "no-cache" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
try_files $uri =404;
}
location ~* ^/(manifest\.json|version\.json)$ {
add_header Cache-Control "no-cache" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
try_files $uri =404;
}
location ~* ^/(flutter_service_worker\.js|flutter_bootstrap\.js|flutter\.js)$ {
add_header Cache-Control "no-cache" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
return 410;
}
location = /graphql {
proxy_pass http://mapflow-api-0bvuyz:4000/graphql;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /telegram/ {
proxy_pass http://mapflow-api-0bvuyz:4000/telegram/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~* ^/assets/.*\.(otf|ttf|woff|woff2)$ {
add_header Cache-Control "public, max-age=31536000, immutable" always;
add_header Access-Control-Allow-Origin "*" always;
types {
font/otf otf;
font/ttf ttf;
font/woff woff;
font/woff2 woff2;
}
try_files $uri =404;
}
location ~* ^/(assets|canvaskit|icons)/ {
add_header Cache-Control "public, max-age=31536000, immutable" always;
try_files $uri =404;
}
location = /main.dart.js {
add_header Cache-Control "no-cache" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
try_files /main.dart.js =404;
}
location ~* \.(js|mjs|wasm|json|png|jpg|jpeg|gif|webp|svg|ico|woff|woff2|ttf)$ {
add_header Cache-Control "public, max-age=31536000, immutable" always;
try_files $uri =404;
}
location / {
add_header Cache-Control "no-cache" always;
try_files $uri $uri/ /index.html;
}
}