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

Refactor encoding check as per brotli module #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robvanoostenrijk
Copy link

Using zstd-nginx-module with the following configuration, does not work on for example autoindex generated documents.

        zstd			on;
        zstd_min_length		64;
        zstd_comp_level		8;
	zstd_types		application/javascript
				application/json
				application/xhtml+xml
				application/xml
				font/opentype
				font/ttf
				image/svg+xml
				image/x-icon
				text/css
				text/plain;

	location /folder {
		alias			/mnt/web/folder;
		autoindex		on;
		autoindex_format	xml;

		xslt_string_param	footer $host;
		xslt_string_param	path $uri;
		xslt_string_param	layout $arg_layout;
		xslt_string_param	sort $arg_sort;
		xslt_string_param	order $arg_order;

		xslt_stylesheet		/etc/nginx/file_index.xslt;
	}

This request returns the following on request:

> GET /folder/ HTTP/2
> Host: server.example
> User-Agent: curl/8.11.0
> Accept: */*
> Accept-encoding: zstd
>
< HTTP/2 200
< date: Sun, 22 Dec 2024 14:54:58 GMT
< content-type: text/html; charset=UTF-8
< content-length: 43743
....

Updating the logic where the filter determines if its going to compress the response, aligning to what Google ngx_brotli uses, resolves the above issue.

Additionally lifting out the request check function to a shared code file ensures the logic is identical for both static and dynamic filters.

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.

1 participant