-
Notifications
You must be signed in to change notification settings - Fork 217
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
gzip not working after adding br to Accept-Encoding #116
Comments
Removing the two gzip lines from here fixes it for me: ngx_brotli/static/ngx_http_brotli_static_module.c Lines 135 to 142 in 9aec15e
As far as I understand it:
@eustas can the static module be changed to move those two lines down to somewhere like here?
At that stage the .br file has been checked to exist, has been read, and the handler is ready to respond. |
I tested with your repo and confirmed this should fix it. Just for reference, how the gzip_ok/tested flags are used in nginx: Interestingly -- |
Hi @adamburgess! Thanks for the deep dive here. I agree with everything you wrote. |
It is strange that the problem described above does not exist after testing multiple times. |
I just re-ran the repro at https://github.com/minac/nginx_brotli_test and the problem definitely still exists... |
(cherry picked from commit 8e1f281)
(cherry picked from commit 8e1f281)
(cherry picked from commit 8e1f281)
Context
In my organization, we have projects that have some statically compressed assets (with gzip and brotli versions), and some not compressed. We recently decided to add Brotli configuration to our nginx to serve those statically compressed assets for clients that ask for them. At this point, we do not want dynamic Brotli compression until we understand the CPU cost associated with it.
Statically compressed files work well
Testing nginx with the
ngx_brotli
module statically compiled and a basic Brotli configuration I can see that calling the assets with uncompressed, gzipped, and brotli'ed versions on disk and the headerAccept-Encoding: gzip,deflate,br
works as expected.Dynamic Brotli configuration woks as expected
If I enable Brotli configuration to dynamically compress assets, it also works as expected.
Uncompressed files do not get gzipped if brotli is in the
Accept-Encoding
headerAssets that do NOT have compressed versions on disk are the problem. When called with the header
Accept-Encoding: gzip,deflate
, the assets come gzipped. But with the headerAccept-Encoding: gzip,deflate,br
they come completely uncompressed. It's as if the Brotli header disables gzip.I created a little repository with a docker image that includes nginx and this module and added the most basic configuration and a random set of assets to test this: https://github.com/minac/nginx_brotli_test.
Questions
Thank you.
The text was updated successfully, but these errors were encountered: