-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Use rewrite for placeholders and improve cache control #4722
Conversation
669505e
to
fb4ae09
Compare
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.
This change seems incomplete.
- The PR description mentions rewrites instead of redirects, but these are not in this PR?
- Removed redirect have no replacement. For example, all the fallback logic is done using redirects, but those have been completely removed and not replaced. For example
dark_logo
falls back tologo
using a redirect; but has been removed without replacement. - Redirects are throwing a status 200 now, which is not correct in the HTTP specification.
../Frenck
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Rewrites are created in Netlify by returning 200 from a redirect rule. It's the equivalent of a rewrite in a The fallback behavior is exactly the same. The only difference is the URL doesn't change in the address bar, which is inconsequential. |
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 fallback behavior is exactly the same.
It isn't.
For example, from the old rules:
[[redirects]]
from = "/brands/_/*/dark_logo.png"
to = "/brands/_/_placeholder/logo.png
Nothing is replacing any of that logic.
../Frenck
That's replaced by: [[redirects]]
from = "/brands/_/*/:image"
to = "/brands/_/_placeholder/:image"
force = false
status = 200 It rewrites to These links return the same placeholder image:
If there's something not working here, I'm happy to fix it, but I don't see any problems when testing the deploy preview. |
That is not a replacement. Again:
Is breaking/missing in this PR. Right now, if the dark logo doesn't exists, it will fallback to the non-dark version. Your version doesn't do that. ../Frenck |
😕 The rule you are quoting doesn't do that either - it falls to the placeholder's non-dark version. But that only happens if the domain doesn't exist. For domains that exist, the build script is handling that logic by making copies when variants are missing. All 8 variants exist if the domain exists with at least an icon. Maybe I'm missing something though. Can you give me a deploy preview link that is not working correctly? |
To try to be ultra-clear on the rule you claim is broken:
In other words, the current rule for dark variants is redundant with the build script: https://deploy-preview-4722--home-assistant-brands.netlify.app//brands/_/epson/dark_logo.png |
@frenck I know you're probably busy with the stream today, but could we please resolve this when you get a chance? I think if you actually test the Netlify preview, you'll see the placeholder fallbacks are working correctly. |
Nearly a month and 90 subsequent PRs have followed this one, the majority of which were promptly merged or approved without much wait. I get this PR isn't simply adding some images, but it is far from an overwhelming and taxing change, and it will benefit all users. Getting this across the finish line would be appreciated. |
You are right, this is not a PR I review I would review from my tablet, the other I would (and do). So, yeah. |
That is really helpful! The part that didn't exist in my mind was: Lines 113 to 121 in ce098e0
So, thanks for pointing that one out. |
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.
Cannot find a single thing that doesn't work as expected on the Netlify preview. So 👍
../Frenck
Proposed change
This makes changes to the Netlify config to fix the referenced issues:
redirects
table into just 2 entries for brevity, and removes theheaders
keys which are not applicable (explained more in Condense redirects using placeholders and remove request headers #4685)stale-while-revalidate
strategy for another 7 days for browsers that support it (Firefox and Chrome at the moment); others will use their internal heuristicsType of change
Python wheels repository
Additional information
Checklist
icon.png
)[email protected]
)logo.png
)[email protected]
)