Prevent PDF Caching With Invoice Ninja 5 (Apache, .htaccess)

Invoiceninja logo

If you find that PDF files aren't updating after changes, it could be that they are cached by the browser or a CDN such as Cloudflare.

If you are running on Apache then you can modify the mod_headers block in the /public/.htaccess file to prevent PDF file caching:

<IfModule mod_headers.c>
    # Blocks Search Engine Indexing
    Header set X-Robots-Tag "noindex, nofollow"

    # Prevents PDF File Caching
    <FilesMatch ".pdf$">
        Header set Cache-Control no-store
  </FilesMatch>
</IfModule>