This repository was archived by the owner on Oct 17, 2026. It is now read-only.
Repository navigation
Compress the SPA's bundles and the API's JSON in nginx - #228
Merged
Merged
Conversation
nginx.conf turned gzip on but set no gzip_types, so nginx compressed only text/html: the 929 KB JS bundle, the CSS, and every JSON API response went out uncompressed. It now compresses text, CSS, JavaScript, JSON, XML, SVG, and WebAssembly over 1 KB, including proxied responses, at level 6, with Vary: Accept-Encoding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nginx.confturnsgzip onbut sets nogzip_types, so nginx compresses onlytext/html. On the live site,index.htmlis gzipped, while the 929 KB JS bundle, the CSS, and JSON API responses such as/api/datasets(19.8 KB) go out uncompressed.Changes
ord_interface/nginx.conf:gzip_typesfor text, CSS, JavaScript, JSON, XML, SVG, and WebAssembly;gzip_proxied anyfor the API;gzip_min_length 1024;gzip_vary on;gzip_comp_level 6. The search-results download isapplication/gzipand already compressed, so it is left out.Testing
nginx -tpasses innginx:alpine.nginx:alpinewith this config: the production JS bundle 929 KB → 202 KB, plus CSS, JSON, andindex.html, allContent-Encoding: gzipwithVary: Accept-Encoding. TheCache-Controlheaders are unchanged, and a request withoutAccept-Encodinggets the plain file.Notes
gzip_proxied anyandapplication/jsonsettings through a proxied route.interfacestack.🤖 Generated with Claude Code
The PR appears safe to merge.
What we checked:
application/gzip, which is not included ingzip_types.Summary
Enables gzip for SPA assets and JSON API responses in
nginx.conf.Vary: Accept-Encodingand keeps the existing cache policy.Reviews (1) · Last reviewed commit: "Compress the SPA's bundles and the API's..."