Mark Redding
Mark Redding

Reputation: 209

Adobe PDF Reader keeps opening previously read document

We have a rails application that serves up PDFs to users via send_file

We are getting complaints that when the user opens multiple PDFs in a given day, when they click on our link, adobe opens the PDF they read last time.

We have looked at our logs / audits and everything appears that the correct data was sent to the user's browser.

We are unable to reproduce this problem, and we are only getting 1 or 2 out of thousands of users that are running into this issue.

The only workaround right now is for the user to close all instances of Firefox.

Anyone ever seen anything like this before?

Upvotes: 0

Views: 1961

Answers (1)

niiru
niiru

Reputation: 5112

It sounds like a caching issue to me.

I add this to the headers of the PDF's my web applications serve:

  format.pdf do
    response.headers['Accept-Ranges'] = 'none'
    response.headers['Cache-Control'] = 'private, max-age=0, must-revalidate'
    response.headers['Pragma']        = 'public'
    response.headers['Expires']       = '0'
    render
  end

I added these headers to solve issues serving Internet Explorer clients over SSL and there may be more in there than you need, but it looks like it could solve your issue, too.

Upvotes: 0

Related Questions