-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(brotli): Preserve ETag and Last-Modified headers in Brotli-compressed response #12853
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
base: master
Are you sure you want to change the base?
Conversation
apisix/plugins/brotli.lua
Outdated
|
|
||
| if not matched[1] then | ||
| -- strong etag, downgrade it | ||
| ngx.header.etag = [[W/"]] .. matched[2] .. [["]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is recommended to use core.response.set_header to maintain consistent code style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @yuweizzz, similar issues exist in other parts of the code; please correct them all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check it again.
| end | ||
|
|
||
| local regex = [[^(W/)?"(.*)"$]] | ||
| local matched, err = ngx.re.match(etag, regex, "jo") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The err variable is declared but never used; if a regular expression match fails, an error should be logged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
Description
Downgrade etag when in needed.
Which issue(s) this PR fixes:
Fixes #12707
Checklist