-
Notifications
You must be signed in to change notification settings - Fork 104
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
Add Site Health test to verify that static assets are served with far-future expires #1727
base: trunk
Are you sure you want to change the base?
Conversation
plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Show resolved
Hide resolved
} | ||
|
||
return $final_status; | ||
} |
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.
Currently even if one asset fails the header check then this test will be show in the site health. Would it be better to show a table with mime type which will specifically tell for which mime type needs to add the Cache-Control
headers?
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.
A table makes sense to me.
'<p>%s</p>', | ||
esc_html__( 'Far-future Cache-Control or Expires headers can be added or adjusted with a small configuration change by your hosting provider.', 'performance-lab' ) | ||
); | ||
} |
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.
There are two different checks which are getting performed one with Cache-Control
, Expires
and other with Etag
, Last-Modified
should there be different messages shown based on the checks?
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.
In the new 3db5886 commit a table is used to display reason for different failure cases.
…ate a report table for missing headers
…and updating the extensions table generation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Summary
Fixes #323
Relevant technical choices
Test are based on the
Cache-Control
withmax-age
or anExpires
to determine if the static assets are served with far future expires. IfCache-Control
andExpires
are unavailable then theETag
andLast-Modified
are used to do a secondary request to the same asset URL withIf-None-Match
andIf-Modified-Since
, respectively. If those return with 304 Not Modified then that could pass the test as well.