How to exclude a specific template from being cached by a CDN

I’m using a specific template on my self-hosted WordPress blog to display a page with randomized posts.

Recently, I configured W3 Total Cache to make use of a content delivery network (CDN). When not logged in as the administrator, a user will have some elements of the site served through the CDN instead of fetching a “live” version from the original server where it is hosted.

Read More

I noticed the randomization will not worked if the site is served through the CDN, but works perfectly well is served directly from the original server. More precisely, random posts will be displayed the first time the random post page is invoked. However, if the page is invoked again (or refresh from the browser) the very same posts will be displayed again. Whereas, when working normally, the page will displayed random posts each time it is accessed (or each time the page is refreshed from the browser).

W3 Total Cache has a specific field where the user can input content that must be exclude from the CDN. An example involving such an exclusion can be found here.

The question is simple: how can I exclude my random post template from being served through the CDN? Do I need to input the URL of the random post page or maybe the location of the template that does the randomization?

Thanks a lot,

P.

Related posts

Leave a Reply

2 comments

  1. Got the solution. Instead of using the CDN exclusion list, I use the plugin (W3 Total Cache) “Page Cache” option.

    Once logged in as the administrator, go to W3 Total Cache settings (a tab called “Performance”). Navigate to “Page Cache” and then to the field named “Never cache the following pages:” Finally enter the name of the page. For example, if the URL of your page is http://my_blog/random all you have to do is add the word random in the field.

    It works even with a CDN set up.

    P.