Export option "disable caching" does not work

Workarounds and usability notes.

Export option "disable caching" does not work

Postby Clifton » Tue Apr 25, 2017 12:28 pm

You may have noticed that in some cases if content is set to have caching disabled, it will still be cached by the web server and sometimes even by the client browser.

WHY DOES THIS HAPPEN?
    Modern web servers use a variety of page caching server and these will not honor the <meta> tags in the ToolBook export that expressly tells the server NOT to cache the data. Generally, the only way to get the caching server to NOT cache the page is to reconfigure the settings of the caching server itself. And most users may not have access to these configuration files as they are locked by the server administrator.
IS THERE A WAY TO ENSURE THAT CACHING (enabled or disabled) IS HONORED BY SERVER AND BROWSER?
    If your server is able to recognize and use an .htaccess file and you are using an Apache server, then the following suggestion may work for you.
    1. Create an .htaccess file in your ToolBook book folder and flag it for inclusion in the export of your book like this:
      Image 1.png
      Flag .htaccess file for inclusion in export using the DHTML Export Tree Manager
      Image 1.png (82.78 KiB) Viewed 2192 times

    2. Make sure the contents of the .htaccess file are as shown below:
      Code: Select all
      # Disallow caching of files in this folder
      <FilesMatch "\.(html|htm|js|css|php|xml)">
         FileETag None
         Header unset ETag
         Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
         Header set Pragma "no-cache"
         Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
      </FilesMatch>
    We have had good success with this procedure on a web server that used the NGINX page caching server. Once we made the edits shown in this post, it was no longer necessary to disable the NGINX server to get a fresh copy of the page each time the client loaded the application.

    NOTE: This technique assumes you have marked your exported content to have page caching disabled. This will ensure that the PowerPac inserts the necessary <meta> tags in the .html files of the exported content that tell the server to disable caching for these pages. See below:
    Image 2.png
    Flag content to "disable" caching
    Image 2.png (11.29 KiB) Viewed 2192 times
Of course, your results may vary.
Your findings and solutions to this problem are always appreciated.
Just add your replies to this topic so we can all benefit.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron