-
Notifications
You must be signed in to change notification settings - Fork 218
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
Variable compression level #58
base: master
Are you sure you want to change the base?
Conversation
Hello, Bartosz. Would you mind if I pick this change to my fork? |
Hello @eustas, feel free to use this if you want - this project looks abandoned and probably no one will ever merge this in. Nice to know that you found my contribution useful ;) |
Hi. Overall patch looks good, but what is the use-case? |
@eustas I wanted to have a possibility of using variable compression level. That way for example I could better compress (thus use more CPU) objects cached for longer durations or with specific mime type, such as static content. This can be sometimes achieved with multiple locations, but is usually more cumbersome. The same applies to other nginx directives allowing constants only... |
This is great! You could set different compression level based on upstream's cache control response header. This would allow you to use better compression for resources that can be cached, and worse compression for no-cache/private resources using a map. I rebased this PR onto master in my fork, though there's still some unrelated commits in my branch which I'd like to clean up first. |
I added some changes to improve performance when brotli_comp_level is used with a static value. In such cases we don't want to evaluate the complex value on every http request. Instead, evaluation is done at config merge time when nginx is still starting up. |
This is great!! Would love to see it merged :) |
This PR makes
brotli_comp_level
accept variable expression.It allows to make compression level (and its cost) variable on user defined criteria, for example cacheability of upstream response.