Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brotli_static and zstd_static Wrong Module order #40

Open
mklooss opened this issue Nov 20, 2024 · 1 comment
Open

brotli_static and zstd_static Wrong Module order #40

mklooss opened this issue Nov 20, 2024 · 1 comment

Comments

@mklooss
Copy link

mklooss commented Nov 20, 2024

i am currently struggle to get "zstd_static on" and "brotli_static on", because Webkit does not Support zstd.

zstd_filter works as expected

Build:

./configure --add-module=zstd-nginx-module-master --add-module=ngx_brotli-master

Result:

$ curl -v -k -H 'Accept-Encoding: gzip, deflate, br, zstd' https://172.17.0.2/test.css
> GET /test.css HTTP/1.1
> Host: 172.17.0.2
> User-Agent: curl/8.5.0
> Accept: */*
> Accept-Encoding: gzip, deflate, br, zstd
> 
< HTTP/1.1 200 OK
< Server: nginx/1.26.2
< Date: Wed, 20 Nov 2024 20:15:21 GMT
< Content-Type: text/css
< Content-Length: 30
< Last-Modified: Wed, 20 Nov 2024 19:33:50 GMT
< Connection: keep-alive
< Vary: Accept-Encoding
< ETag: "673e399e-1e"
< Content-Encoding: br

@mklooss
Copy link
Author

mklooss commented Nov 20, 2024

Okay, found an workaround for me:

had to reorder the module list, so i have to first define brotli and then zstd in configure task:

./configure --add-module=ngx_brotli-master --add-module=zstd-nginx-module-master

and the this patch for zstd

diff -u -r a/filter/config b/filter/config
--- a/filter/config        2024-11-20 19:20:15.000000000 +0000
+++ b/filter/config   2024-11-20 20:49:50.419587235 +0000
@@ -128,8 +128,9 @@
 if [ "$ngx_module_link" != DYNAMIC ]; then
     # ngx_module_order doesn't work with static modules,
     # so we must re-order filters here.
-
-    if [ "$HTTP_GZIP" = YES ]; then
+    if echo $HTTP_FILTER_MODULES | grep ngx_http_brotli_filter_module >/dev/null; then
+        next=ngx_http_brotli_filter_module
+    elif [ "$HTTP_GZIP" = YES ]; then
         next=ngx_http_gzip_filter_module
     elif echo $HTTP_FILTER_MODULES | grep pagespeed_etag_filter >/dev/null; then
         next=ngx_pagespeed_etag_filter
diff -u -r a/static/config b/static/config
--- a/static/config        2024-11-20 19:20:15.000000000 +0000
+++ b/static/config   2024-11-20 20:29:15.728061021 +0000
@@ -107,5 +107,7 @@
 ngx_module_name=ngx_http_zstd_static_module
 ngx_module_incs="$ngx_zstd_opt_I"
 ngx_module_srcs=$HTTP_ZSTD_SRCS
+ngx_module_order="ngx_http_brotli_static_module \
+                  $ngx_module_name"
 
 . auto/module

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

No branches or pull requests

1 participant