server { listen 80; server_name localhost; # Soporte MIME type para WebAssembly (Flutter CanvasKit / WASM) include /etc/nginx/mime.types; types { application/wasm wasm; } # Compression optimizations gzip on; gzip_vary on; gzip_min_length 10240; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript application/json application/wasm; gzip_disable "MSIE [1-6]\."; location /api/ { proxy_pass https://api.hidalyx.com; proxy_http_version 1.1; proxy_set_header Host api.hidalyx.com; proxy_ssl_server_name on; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_connect_timeout 60s; proxy_send_timeout 300s; proxy_read_timeout 300s; proxy_redirect off; } location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html; # Disable caching for entrypoint html add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"; add_header Pragma "no-cache"; add_header Expires "0"; } # NEVER CACHE JavaScript entrypoints, manifests, service worker or version files location ~* (?:index\.html|.*\.js|version\.json|manifest\.json|AssetManifest.*|FontManifest.*|flutter_service_worker\.js)$ { root /usr/share/nginx/html; add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always; add_header Pragma "no-cache" always; add_header Expires "0" always; add_header Cloudflare-CDN-Cache-Control "no-store, no-cache, max-age=0" always; add_header CDN-Cache-Control "no-store, no-cache, max-age=0" always; } # Font files and icons (MaterialIcons, Inter, Cupertino): # Short cache with mandatory revalidation to immediately load new glyphs on deploy location ~* \.(?:otf|ttf|woff2?|eot)$ { root /usr/share/nginx/html; expires 1h; add_header Cache-Control "public, max-age=3600, must-revalidate" always; add_header Access-Control-Allow-Origin "*" always; } # Static media assets (images, audio, css, wasm) location ~* \.(?:ico|css|gif|jpe?g|png|wasm)$ { root /usr/share/nginx/html; expires 7d; add_header Cache-Control "public, max-age=604800" always; } # SVGs (quick revalidation to avoid stale logo caches) location ~* \.svg$ { root /usr/share/nginx/html; add_header Cache-Control "no-cache, must-revalidate" always; add_header Pragma "no-cache" always; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }