perf(webapp): gzip responses and cache the hashed bundles for a year in nginx
Problem
The web app's nginx (.deploy/webapp/nginx.prod.conf, used by the stage/prod images, and nginx.compose.conf) has #gzip on; commented out, and the ingress in front of it compresses nothing either. The Angular bundles — several MB of JavaScript — are shipped uncompressed on every first load, and the hashed bundles carry no Cache-Control, so returning browsers revalidate each of them.
Change
Both configs:
gzip onwithgzip_vary,gzip_proxied any, level 5, from 1 KB, for text/JS/CSS/JSON/SVG/font types (woff2 and images are already compressed and are left alone). Responses proxied from the API through the compose nginx are covered bygzip_proxied any; the API now compresses its own responses (#11065) and nginx does not re-encode a body that already hasContent-Encoding.location ~* "^/[^/]+[.-][0-9a-z]{8,}\.(js|css)$"→Cache-Control: public, max-age=31536000, immutable: the build names every bundle and stylesheet with a content hash (main-XXXXXXXX.js,styles-XXXXXXXX.css; the webpack builder'smain.<16 hex>.jsmatches too), so a changed file has a new name.index.htmlkeeps its existingno-cache, must-revalidate, and/assets/(unhashed) keeps its existing block and default caching — nothing there is cached longer than before.
No build or runtime code changes; the stage image build + a page load on stage (response headers Content-Encoding: gzip on main-*.js, Cache-Control: ... immutable on the hashed bundles) is the verification, per the owner's "verify when it lands on develop / stage" instruction.
Per the owner's rule for Gauzy API/UI: develop → stage only.
🤖 Generated with Claude Code
Summary by cubic
Enables gzip compression and long-term caching for the web app in both nginx configs, and narrows the cache rule so bundles rewritten with runtime environment values revalidate instead of pinning stale data.
- Compresses text/JS/CSS/JSON/SVG/font responses with gzip;
gzip_proxied anycovers API-proxied responses. - Serves content-hashed
.js/.cssbundles withCache-Control: public, max-age=31536000, immutable, except bundles the entrypoints rewrite with environment values at container start — those getno-cachevia an entrypoint-generated nginx map. - Cache headers now only apply on successful responses, so a bundle missing during a rolling deploy is never cached.