Disabling Browser and Apache Caching to See Your Changes to Tableau Server

This post isn’t about viz caching, but rather about disabling the caching in the browser and in Apache so that you can see your changes as you modify CSS or other files when customizing vizqlserver and vizportal.

Browser Cache

Browser cache is always an issue when trying to see the latest version. The best method for rapid testing I’ve found is Google Chrome’s Developer Tools. Under the Network tab, there is a wonderful “Disable cache” check box. Regardless of what tab you are looking at, once this check box is clicked, as long as the Developer Tools toolbar is up (no matter how minimized), every page refresh will get a new version from the web server.

Apache Cache

That’s not enough though, because Tableau Server also has caching on at the Apache web server level. All of this is controlled in the standard httpd.conf file, which is located at:

C:\ProgramData\Tableau\Tableau Server\data\tabsvc\config\httpd.conf

Even better, this change persists through Tableau Server installations the best I can tell.

Go through the .conf file and find anywhere with ‘ExpiresDefault’ set to “access plus 1 year” and change it to “access plus 2 seconds”. Then restart Tableau Server. Now Apache won’t be serving up a cached version to the browser after 2 seconds.

Later you can change it to a longer time period, although I don’t know that 1 year is ever necessary.

Update: Recently, one of the excellent support engineers at Tableau let me in on this tip:

“The httpd.conf gets updated whenever configuration is saved or tabadmin config is ran. You would need to update the template if you want it to persist.

Tableau Server\10.0\templates\httpd.conf.templ (primary or single-node)

Tableau Server\worker\templates\httpd.conf.templ (worker)”

So if you want persistent changes, you’ll need to update the template (and that of course will be overwritten when you make your next upgrade. Such is the life of hacks).

gzip files

One last hurdle to making changes is that there are .gz versions of each HTML/CSS/JS file which the Apache server is configured to be used if they exist instead of the real file. If you want to test a change, you need to remove the .gz file somehow (the easiest way is to add ‘.original’ to the end of the file after .gz) so that the .html/.css file is being used. You can save your edited HTML/CSS file later to a .gz so it is served up even more quickly.

Advertisements

7 comments

  1. I was trying to make some changes for vizportal.js and passed through each step but it didn’t work out.
    I had put comment line into vizportal.css and vizportal.js and after restart the changes was applied only for first one.
    What should I do to avoid cache for vizportal.js? Thank you in advance

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s