Skip to content

nginx-util: specify gzip_types to actually enable gzip#27557

Open
gxcreator wants to merge 1 commit into
openwrt:masterfrom
gxcreator:nginx-util_gzip_types_all
Open

nginx-util: specify gzip_types to actually enable gzip#27557
gxcreator wants to merge 1 commit into
openwrt:masterfrom
gxcreator:nginx-util_gzip_types_all

Conversation

@gxcreator

@gxcreator gxcreator commented Sep 29, 2025

Copy link
Copy Markdown
Contributor

📦 Package Details

Maintainer: @peter-stadler

Description:
Specify wildcard gzip_types to actually enable gzip.


🧪 Run Testing Details

  • OpenWrt Version: SNAPSHOT r31193-605543bc7b
  • OpenWrt Target/Subtarget: Mediatek ARM/MT7622
  • OpenWrt Device: RT3200_UBI (Linksys E8450 UBI)

Before:
1

After:
изображение


✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

If your PR contains a patch:

  • It can be applied using git am
  • It has been refreshed to avoid offsets, fuzzes, etc., using
    make package/<your-package>/refresh V=s
  • It is structured in a way that it is potentially upstreamable
    (e.g., subject line, commit description, etc.)
    We must try to upstream patches to reduce maintenance burden.

@BKPepe BKPepe requested a review from Ansuel October 1, 2025 17:39
@Neustradamus

Copy link
Copy Markdown

@Ansuel: What do you think?

@Ansuel

Ansuel commented Nov 14, 2025

Copy link
Copy Markdown
Member

@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)

@gxcreator gxcreator force-pushed the nginx-util_gzip_types_all branch 3 times, most recently from bebd4d4 to e40a3fc Compare April 21, 2026 20:25
@BKPepe BKPepe force-pushed the nginx-util_gzip_types_all branch from e40a3fc to eb00e3a Compare July 6, 2026 08:12

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit checks

  • nginx-util: specify gzip_types to actually enable gzip — the commit changes packaged content in two packages but bumps neither PKG_RELEASE: net/nginx-util/Makefile (still PKG_RELEASE:=2, changed files/uci.conf.template) and net/nginx/Makefile (still PKG_RELEASE:=1, changed files/nginx.init). Per OpenWrt convention a content change should bump PKG_RELEASE so users receive the update (also flagged by the formality bot). The message also only describes the gzip_types addition and doesn't mention the LATEST_UCI_CONF_VERSION bump.

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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 *;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@gxcreator gxcreator force-pushed the nginx-util_gzip_types_all branch 2 times, most recently from 14c3ba4 to 5e71b0d Compare July 10, 2026 19:09

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit checks

  • nginx-util: specify gzip_types to actually enable gzip — the migration block and the template UCI_CONF_VERSION marker requested in the previous review are now both in place, and the 1.2 migration traces correctly (adds gzip_types *;, then stamps 1.3). Two items remain:
    • Neither package bumps PKG_RELEASE even though both ship changed content: net/nginx-util/Makefile (still PKG_RELEASE:=2, changed files/uci.conf.template) and net/nginx/Makefile (still PKG_RELEASE:=1, changed files/nginx.init). A functional change like enabling gzip should bump PKG_RELEASE so opkg/apk offers the update to existing installs (also flagged by the formality bot).
    • The commit message still only describes the gzip_types addition and doesn't mention the UCI_CONF_VERSION 1.2→1.3 migration it introduces.

See the inline comment for a minor indentation nit on the migration sed.


Generated by Claude Code

Comment thread net/nginx/files/nginx.init Outdated
# 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Suggested change
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>
@gxcreator gxcreator force-pushed the nginx-util_gzip_types_all branch from 5e71b0d to ac09185 Compare July 11, 2026 12:38

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bump PKG_RELEASE (net/nginx-util 2→3, net/nginx 1→2), and the migration sed indentation is corrected to a single tab so the injected gzip_types *; lines up with the sibling gzip_proxied any; in uci.conf.template. LATEST_UCI_CONF_VERSION="1.3", the template's # UCI_CONF_VERSION=1.3 stamp, and the 1.2→1.3 migration are all consistent. One item still stands from before: the commit message/body describe only the gzip_types addition and don't mention the UCI_CONF_VERSION 1.2→1.3 migration or the PKG_RELEASE bumps the commit now carries.

Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants