Hello @digitalpoint,Avatars and thumbnails have file extensions that are cacheable by Cloudflare, so it's not necessary to create specific page rules for them as long as your web server is configured properly.
For Nginx, I use this in the config (which in turn passed through by Cloudflare and causes things to be cached at the edge for a year without needing to use up any of your Cloudflare page rules):
NGINX:location /data/ { add_header Cache-Control "public, max-age=31536000"; } location /js/ { add_header Cache-Control "public, max-age=31536000"; } location /styles/ { add_header Cache-Control "public, max-age=31536000"; } location /favicon.ico { add_header Cache-Control "public, max-age=31536000"; } location ~ \.(svgz)$ { add_header Content-Encoding "gzip"; add_header Vary "Accept-Encoding"; add_header Cache-Control "public, max-age=31536000"; }
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/shtml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
<ifModule mod_expires.c>
ExpiresActive On
# Add default Expires header
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|svg|woff|woff2)$">
ExpiresDefault "access plus 1 year"
</FilesMatch>
</ifModule>
Suppose, the style of the website gets heavily re-worked and needs, as a result, to be re-cached. How would you go about purging the CSS by URL in Cloudflare?CSS is the only one that is really needed because Cloudflare will not cache a request with a php extension unless you force it to with a page rule.
Thanks!The URL of XenForo CSS files change anytime they are edited, so you don’t need to do anything as far as telling Cloudflare to purge it’s cache. New URL = Cloudflare pulls new data from your site.
I do see CSS reported under Domain > Analytics > Performance > Content Type Breakdown (chart) without a page rule for CSS caching added. Doesn't this mean they cache XenForo CSS?[…] Cloudflare will not cache a request with a php extension unless you force it to with a page rule.
cf-cache-status
header in the HTTP response will tell you if Cloudflare is caching it or not.cf-cache-status: DYNAMIC
cf-cache-status: HIT
Cloudflare only caches based on file extension and not by MIME type.
cf-cache-status
header means. Basically, DYNAMIC
means it's not cached and Cloudflare isn't trying to cache it.HIT | The resource was found in Cloudflare’s cache. |
MISS | The resource was not found in Cloudflare’s cache and was served from the origin web server. |
NONE | Cloudflare generated response. The resource is not eligible for caching. |
EXPIRED | The resource was found in Cloudflare’s cache but was expired and served from the origin web server. |
STALE | The resource was served from Cloudflare’s cache but was expired. Cloudflare could not contact the origin to retrieve an updated resource. |
BYPASS | The origin server instructed Cloudflare to bypass cache via a Cache-Control header set to no-cache,private, or max-age=0 even though Cloudflare originally preferred to cache the asset. BYPASS is returned when enabling Origin Cache-Control. Cloudflare also sets BYPASS when your origin web server sends cookies in the response header. |
REVALIDATED | The resource is served from Cloudflare’s cache but is stale. The resource was revalidated by either an If-Modified-Since header or an If-None-Match header. |
UPDATING | The resource was served from Cloudflare’s cache and was expired, but the origin web server is updating the resource. UPDATING is typically only seen for very popular cached resources. |
DYNAMIC | Cloudflare does not consider the asset eligible to cache and your Cloudflare settings do not explicitly instruct Cloudflare to cache the asset. Instead, the asset was requested from the origin web server. Use Page Rules to implement custom caching options. |
We use essential cookies to make this site work, and optional cookies to enhance your experience.