Dont check "Cache-Control: no-transform" in encode directive #7561
Open
elee1766 wants to merge 4 commits intocaddyserver:masterfrom
Open
Dont check "Cache-Control: no-transform" in encode directive #7561elee1766 wants to merge 4 commits intocaddyserver:masterfrom
elee1766 wants to merge 4 commits intocaddyserver:masterfrom
Conversation
Member
|
Thanks for pointing out the wording of the spec, I wasn't aware of that. Yeah I agree we should make sure both origin and intermediary roles are served well. In the case of using souin, then it is an intermediary, and perhaps souin should be responsible for handling that somehow, or documenting to the user how to configure encode accordingly for that. Also curious to hear Sylvain's thoughts! |
This file contains hidden or 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
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.
Currently, the encode directive will not compress if the
no-transformvalue is set in thecache-controlheader.this was changed in #5257
in which it was floated in this souin issue that darkweak/souin#289 that perhaps
encodeshould respect theno-transformdirective.cited was these specifications:
rfc-editor.org/rfc/rfc7234#section-5.2.1.6
rfc-editor.org/rfc/rfc7234#section-5.2.2.4
which state:
Since caddy is being used as an intermediary in the case of souin, i believe this is why the behavior was added to the encode directive.
However, I believe that this is incorrect to do. this is because the specification clearly states that it is an
intermediarythat must not transform the payload, and the encode directive, along with caddy itself, is not always used as an intermediary. one example could be serving files from disk.if one is to run caddy as an intermediary, it would be correct then the user i believe to do something like
instead of using the encode middleware bare. this behavior shot me in the foot trying to use caddy behind a cdn. both trafik and nginx do not seem to perform this check for no-transform.
not sure if @darkweak you have any strong opinions about this, since you added this originally for your consumer. maybe it would make sense for the matcher to be added to souin examples?
Assistance Disclosure
n/a