George Mason University Antonin Scalia Law School

Force Update of PDFs

When replacing an existing PDF, browsers don’t serve the latest version. They usually serve the cached version. To change that, we use Apache directives as below:

# Instruct browsers to always check for the latest version of your files using Apache directives
<IfModule mod_headers.c>
<FilesMatch "(?i)^.*\.(css|htm|html|gif|jpg|jpeg|js|png|pdf)$">
Header set Cache-Control "max-age=0,must-revalidate"
</FilesMatch>
</IfModule>

The instruction above includes more than just PDF.

Another solution is using ?ver=x.x in the URL. For example:

https://www.law.gmu.edu/assets/css/2015/style.css?ver=2.0

x.x could be any number.

Source: “How to force an update of cached files, images, favicon