-
Notifications
You must be signed in to change notification settings - Fork 536
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
Removing "accept" header from cache/originRequest policy when AutoWebP is disabled. #372
base: main
Are you sure you want to change the base?
Removing "accept" header from cache/originRequest policy when AutoWebP is disabled. #372
Conversation
Notice: There's another PR that tries to address the same task. Current PR (mine) aims to replace it. |
d233e8d
to
26d617e
Compare
Hi! -- What I did was extracting the code that creates that resources into classes imitating L2 classes Notice for code reviewers: github's diff is not smart enough when showing only the second commit, and is displaying as removed / added a lot of lines that hasn't been modified. I would recomend using the "all commits" view which shows the differences properly. |
@fvsnippets thank you for your contribution. We will look into it and add it to our backlog. |
This pr has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
Keeping it open. |
This pr has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
…P is disabled. This will improve cloudfront's cache hit ratio, and stop sending unnecesary header to origin.
26d617e
to
c4ecded
Compare
Updated with current main branch (using rebase). Conflicts were resolved. Also fixes eslint issues on my PR. |
Hi @fvsnippets, Overall I like this change, my only concern is that this will remove the ability to enable AutoWebP through the Lambda environment variables after the fact. Some changes to the documentation may overcome this, though I'm concerned it may still confuse users when modifying the environment variable doesn't do anything. Simon |
Hi @simonkrol I do not think that (manual) modification of this particular variable after deploy (in the lambda) is the best choice for consumers of this solution, but yes, you are right. I haven't worked with AWS in a while, but if I recall correctly you can also (manually) modify CloudFront to re-include the (now missing) header "accept", right? |
Hi @fvsnippets, We can definitely improve the documentation there, my concern is mostly around having exceptions like these, where the IG indicates "you can change any of the env variables in the same way, except AutoWebP, which requires that you read this other section and perform an additional step". It may be wise that we rework that section of the document, aiming instead to have users update their stacks with the updated parameters, which would handle all of these issues for us. I'll chat with the team some more, and hopefully we can come to a decent solution. Thanks for your contributions here :) |
Hi @fvsnippets, Thanks again for your contributions to SIH, |
There's no need to include the
accept
http header in the cloudfront's cache key whenAutoWebP
is disabled.These changes will improve the cloudfront's cache hit ratio when
AutoWebP
is not used. Also stops sending unnecesary header (in such case) to origin (resizing backend).Issue #, if available:
#304
Description of changes:
Infrastructure generation code was modified. Added a cloudformation's boolean condition (
CfnCondition
) based onAutoWebPParameter
value, and evaluated it (using a cloudformation'sFn::If
instrinsic function) inside cache/originRequest policy code.Had to switch to "Cfn", aka L1, versions of cache/originRequest policy. Please read this issue.
Tests were updated to reflect changes.
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.