-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix(brotli-plugin): Skip brotli compression for upstream compressed response #10740
Merged
monkeyDluffy6017
merged 12 commits into
apache:master
from
SilentEntity:skip_brotli_compression
Jan 12, 2024
Merged
fix(brotli-plugin): Skip brotli compression for upstream compressed response #10740
monkeyDluffy6017
merged 12 commits into
apache:master
from
SilentEntity:skip_brotli_compression
Jan 12, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SilentEntity
changed the title
Skip brotli compression
fix(brotli-plugin): Skip brotli compression for upstream compressed response
Jan 2, 2024
Could you add some test cases? |
I think it's reasonable, multiple compressions may cause unnecessary trouble |
please make the ci pass |
monkeyDluffy6017
added
wait for update
wait for the author's response in this issue/PR
and removed
need test cases
labels
Jan 5, 2024
okay, it's ready |
The typo is fixed. It will pass in CI. |
The ci still failed |
Hi @monkeyDluffy6017, please check now |
monkeyDluffy6017
approved these changes
Jan 11, 2024
monkeyDluffy6017
removed
wait for update
wait for the author's response in this issue/PR
user responded
labels
Jan 11, 2024
AlinsRan
approved these changes
Jan 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Skipping the
brotli
compression if the upstream response is already compressed.The Problem
The problem occurs when the upstream service sends compressed data/response either in
gzip
ordeflate
. Apisix tries to compress data inbrotli
which is already compressed and, in turn, returns encoded data that can not be used by the browser or application.Possible Solutions
There are two options to solve the problem first to skip the further compression and return with the upstream compressed response. The second is to decompress the upstream response and then compress using
brotli
, which is not viable on apisix gateway, it increases the overhead of the gateway and results in increasing latency and computation requirements.This PR solves the Issue by skipping the
brotli
compression if the upstream response is compressed.Checklist