Browser will not ask for the latest PDF from the server

I have a PDF on a Windows Server IIS web server where users are requesting it using IE8 / 9/10 with an HTTP call like this ...

http: // mydomain.com / somefolder / myFile.pdf

      

The first hit will download the file without issue. Problem : If the admin refreshes the PDF and the user goes back to reload, IE only shows the local cached version and will NOT ask for a new version from the server.

I have confirmed that IE8, IE9 and IE10 do not call the server at all for the PDF file at the second request. Not even a conditional request (like if-updated-since). Confirmed this with Fiddler and WireShark. But I have never set up caching with Max-Age or anything else. I have no caching for this folder. I would rather not set the "expire immediately" cache. It does this for Word DOC too.

Is there a bug in Internet Explorer that makes it ALWAYS use local copies of static documents (eg PDFs, DOCs) no matter what?

These ideas DO NOT work:

  • F5, CTRL+ F5, SHIFT+F5

  • Clear your browser history and cache with the DELETE HISTORY button. Why doesn't it actually clear EVERYTHING, the cache is outside of me. I have everything selected for deletion except passwords.

The only thing I know about this is:

  • Manually delete the PDF locally, because the DELETE HISTORY button does not delete the local version. But most users aren't that smart.

  • Use Firefox, but it's not a company-approved browser. Don't start me.

  • Set server caching to expire immediately, but pdfs get mixed up in web page folders and I prefer not to. I want to use max cache age for other things like CSS, scripts, images, etc.

  • Add a fake query string to the end, how? id = 1 and it works, but there are 100 documents in the business line, each containing links within documents that need to be updated.

    / li>
  • Use the "clear cache" button FIDDLER or CCleaner, but most of my company's users (70k employees) are not developers and cannot have this software.

Is there a real solution for this to get IE to behave the way I thought it would?

+3


source to share


2 answers


I was able to modify the htaccess file to add age to the pdf cache. This worked great for fixing this issue in IE and other browsers where the issue of refreshing or reopening the browser was fixed.



# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On

<FilesMatch ".(pdf)$">
  Header set Cache-Control "max-age=0"
</FilesMatch>

</IfModule>

      

+2


source


As with GNakano's answer to using cache expiration for each file type using .htaccess (in Apache), the following post describes how to set the cache expiration for each directory using web.config in IIS: How to configure the static content cache for each folders and extensions in IIS7?



With this approach, you just need to put all the .pdf and .docx in a separate folder (no caching) and then you can still cache for other things.

+1


source







All Articles