brickell221
Forum Replies Created
-
Saumya,
I added the following code above
# END WP Cloudflare Super Page Cache# Added to bypass mp4 files from Cloudfare's Cache. <FilesMatch "\.(mp4)$"> <IfModule mod_headers.c> Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0" </IfModule> </FilesMatch> # Added to cache only header mp4 file <FilesMatch "header\.(mp4)$"> <IfModule mod_headers.c> Header set Cache-Control "public, must-revalidate, proxy-revalidate, immutable, max-age=31536000, stale-while-revalidate=86400, stale-if-error=604800" </IfModule> </FilesMatch>I can confirm all mp4 files give
cf-cache-status: BYPASSexcept the header video “header.mp4” which givescf-cache-status: HITDo you a see a problem/conflict with this solution?
Understood Saumya.
– technically you can do that but for that you need to write a bit complicated htaccess rule to have one cache-control value for one specific mp4 file while others have a different value.
Can you please help me with this rule?
Also, since caching mp4 files is not forbidden by cloudfare (under the conditions you mentioned), could I add some code to just cache 1 mp4 file (1-2MB) and keep the rest on bypass?
<FilesMatch "\video.(mp4)$"> <IfModule mod_headers.c> Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0" </IfModule> </FilesMatch>This is most likely to be wrong but added for explanation purposes
I can confirm now the mp4s files give cf-cache-status: BYPASS.
Im Stil confused about the disclaimer in the code:
# The directives (lines) between "BEGIN WP Cloudflare Super Page Cache" and "END WP Cloudflare Super Page Cache" are # dynamically generated, and should only be modified via WordPress filters. # Any changes to the directives between these markers will be overwritten.Does this mean the changes will be overwritten eventually? Would I have to keep changing the cache rules periodically?
I don’t really know what I’m doing. I’d like to check with you if I understood correctly.
Based on ur answer, I revised the cache rules that were created by the plugin on .htaccess.
There, under
<FilesMatch "\.(jpg|jpeg|png|gif|ico|eot|swf|svg|webp|avif|ttf|otf|woff|woff2|ogg|mp4|mpeg|avi|mkv|webm|mp3)$"> <IfModule mod_headers.c> Header set Cache-Control "public, must-revalidate, proxy-revalidate, immutable, max-age=31536000, stale-while-revalidate=86400, stale-if-error=604800" </IfModule>deleted the mp4 extension.
Then, above
# END WP Cloudflare Super Page CacheI added the following:<FilesMatch "\.(mp4)$"> <IfModule mod_headers.c> Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0" </IfModule> </FilesMatch>Did I get it right?
Also, in the code theres this message:
# The directives (lines) between "BEGIN WP Cloudflare Super Page Cache" and "END WP Cloudflare Super Page Cache" are # dynamically generated, and should only be modified via WordPress filters. # Any changes to the directives between these markers will be overwritten.I’m still lost.
Thank you for your answer Saumya.
I have Add browsing caching rules for static assets enabled.
If you want to make sure that the MP4s are not gets cached by Cloudflare CDN then you have to make sure that your MP4 files has a cache-control header set with the value of no-cache.
How do I do this? I’m lost.