nginx-util: specify gzip_types to actually enable gzip#27557
Conversation
|
@Ansuel: What do you think? |
|
@gxcreator thanks a lot yep looks good to me BUT you need to bump the uci version template and add the migration here https://github.com/openwrt/packages/blob/master/net/nginx/files/nginx.init (just a simple sed for checking the previous line should be enough) |
bebd4d4 to
e40a3fc
Compare
e40a3fc to
eb00e3a
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Commit checks
nginx-util: specify gzip_types to actually enable gzip— the commit changes packaged content in two packages but bumps neitherPKG_RELEASE:net/nginx-util/Makefile(stillPKG_RELEASE:=2, changedfiles/uci.conf.template) andnet/nginx/Makefile(stillPKG_RELEASE:=1, changedfiles/nginx.init). Per OpenWrt convention a content change should bumpPKG_RELEASEso users receive the update (also flagged by the formality bot). The message also only describes thegzip_typesaddition and doesn't mention theLATEST_UCI_CONF_VERSIONbump.
See inline comments for the missing 1.2→1.3 migration and the un-bumped template version marker.
Generated by Claude Code
| NGINX_UTIL="/usr/bin/nginx-util" | ||
| UCI_CONF_TEMPLATE="/etc/nginx/uci.conf.template" | ||
| LATEST_UCI_CONF_VERSION="1.2" | ||
| LATEST_UCI_CONF_VERSION="1.3" |
There was a problem hiding this comment.
Bumping LATEST_UCI_CONF_VERSION to 1.3 without adding a matching migration block means existing installs never actually receive gzip_types *;. Tracing nginx_check_luci_template() for a template already at 1.2: it skips the early return, skips the 1.1 block, then hits the generic "$UCI_CONF_VERSION" != "$LATEST_UCI_CONF_VERSION" branch which only rewrites the marker to # UCI_CONF_VERSION=1.3. The gzip_types *; line is never inserted, so upgraded users get their template stamped as 1.3 while gzip stays effectively disabled — defeating the purpose of the change. This is the migration Ansuel asked for. A block along these lines is needed, e.g.:
# Enable gzip for all content types
if [ "$UCI_CONF_VERSION" = "1.2" ]; then
grep -q 'gzip_types' $UCI_CONF_TEMPLATE ||
sed -i 's/gzip_proxied any;/gzip_proxied any;\n\tgzip_types *;/' $UCI_CONF_TEMPLATE
fi(placed before the generic version-marker rewrite).
Generated by Claude Code
| gzip on; | ||
| gzip_vary on; | ||
| gzip_proxied any; | ||
| gzip_types *; |
There was a problem hiding this comment.
The shipped template's own version marker is not bumped: line 4 still reads # UCI_CONF_VERSION=1.2, but this file now contains gzip_types *; and LATEST_UCI_CONF_VERSION is 1.3. It should be # UCI_CONF_VERSION=1.3 so the shipped template matches the latest version; otherwise every fresh install ships a template that nginx_check_luci_template() treats as stale and rewrites on first boot.
Generated by Claude Code
14c3ba4 to
5e71b0d
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Commit checks
nginx-util: specify gzip_types to actually enable gzip— the migration block and the templateUCI_CONF_VERSIONmarker requested in the previous review are now both in place, and the 1.2 migration traces correctly (addsgzip_types *;, then stamps 1.3). Two items remain:- Neither package bumps
PKG_RELEASEeven though both ship changed content:net/nginx-util/Makefile(stillPKG_RELEASE:=2, changedfiles/uci.conf.template) andnet/nginx/Makefile(stillPKG_RELEASE:=1, changedfiles/nginx.init). A functional change like enabling gzip should bumpPKG_RELEASEso opkg/apk offers the update to existing installs (also flagged by the formality bot). - The commit message still only describes the
gzip_typesaddition and doesn't mention theUCI_CONF_VERSION1.2→1.3 migration it introduces.
- Neither package bumps
See the inline comment for a minor indentation nit on the migration sed.
Generated by Claude Code
| # Enable gzip for all content types | ||
| if [ "$UCI_CONF_VERSION" = "1.2" ]; then | ||
| grep -q 'gzip_types' $UCI_CONF_TEMPLATE || | ||
| sed -i 's/gzip_proxied any;/gzip_proxied any;\n\t\tgzip_types *;/' $UCI_CONF_TEMPLATE |
There was a problem hiding this comment.
nit: the migration inserts gzip_types *; with two tabs of indentation (\n\t\t), whereas the shipped template and the adjacent gzip_* directives inside http {} use a single tab. Migrated (1.2→1.3) installs would therefore get gzip_types *; indented one level deeper than fresh installs. Purely cosmetic (nginx ignores whitespace), but a single \t keeps migrated and shipped templates byte-identical:
| sed -i 's/gzip_proxied any;/gzip_proxied any;\n\t\tgzip_types *;/' $UCI_CONF_TEMPLATE | |
| sed -i 's/gzip_proxied any;/gzip_proxied any;\n\tgzip_types *;/' $UCI_CONF_TEMPLATE |
Generated by Claude Code
The nginx-util package was missing gzip_types configuration, which meant gzip compression was not being properly applied to responses. This change adds the necessary gzip_types directive to ensure content is compressed. Signed-off-by: Nikita Solianik <gxcreator@gmail.com>
5e71b0d to
ac09185
Compare
openwrt-ai
left a comment
There was a problem hiding this comment.
Commit checks
nginx-util: specify gzip_types to actually enable gzip— this update resolves the two actionable items from the previous review: both packages now bumpPKG_RELEASE(net/nginx-util2→3,net/nginx1→2), and the migrationsedindentation is corrected to a single tab so the injectedgzip_types *;lines up with the siblinggzip_proxied any;inuci.conf.template.LATEST_UCI_CONF_VERSION="1.3", the template's# UCI_CONF_VERSION=1.3stamp, and the 1.2→1.3 migration are all consistent. One item still stands from before: the commit message/body describe only thegzip_typesaddition and don't mention theUCI_CONF_VERSION1.2→1.3 migration or thePKG_RELEASEbumps the commit now carries.
Generated by Claude Code
📦 Package Details
Maintainer: @peter-stadler
Description:
Specify wildcard
gzip_typesto actually enable gzip.🧪 Run Testing Details
Before:

After:

✅ Formalities
If your PR contains a patch:
git am(e.g., subject line, commit description, etc.)
We must try to upstream patches to reduce maintenance burden.