[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Cache Files - Always look for new



CAUTION: This e-mail originated outside the University of Southampton.
Hi James,
PDF caching is a PITA.
If someone has already downloaded a copy, the browser will already have cached it - so you might not even see a request hitting the server (and therefore your Apache changes are never 'hit').

Can you confirm that you see entries in the access log from people with a cached copy - e.g. the browser is actually making a call to the server?

My normal advice is to append a random query string to the end of the PDF URL:
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Frepo.blah%2F123%2F1%2Fstuff.pdf&data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce742405a9297456b6a5f08db4ca74321%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638188054084008166%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=uzwfJLSTwi5U2UG7g3irMazkZnZdcB%2BqiOiuuPoof1I%3D&reserved=0
--> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Frepo.blah%2F123%2F1%2Fstuff.pdf%3Fa&data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce742405a9297456b6a5f08db4ca74321%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638188054084008166%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Y%2FRqYxGqTi%2F7BQlLw8M2h%2Fu1IgNcqXVlAy0JFkhSuDk%3D&reserved=0
--> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Frepo.blah%2F123%2F1%2Fstuff.pdf%3Fb&data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce742405a9297456b6a5f08db4ca74321%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638188054084008166%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=1KELhFZHTWPWAmzR8%2FCsiNboeE0rljiOcbuXvSkFxJE%3D&reserved=0
sort of thing - this will cause a reload - but your user has already said 'no' to this.

If requests are hitting the server, you could use e.g. an EPrints URL rewrite trigger to append a querystring and respond with a redirect.
If requests aren't hitting the server, you'll have to get them to visit a new URL... manually.

Cheers,
John
________________________________
From: eprints-tech-bounces at ecs.soton.ac.uk <eprints-tech-bounces at ecs.soton.ac.uk> on behalf of James Kerwin via Eprints-tech <eprints-tech at ecs.soton.ac.uk>
Sent: 04 May 2023 14:45
To: eprints-tech at ecs.soton.ac.uk <eprints-tech at ecs.soton.ac.uk>
Subject: [EP-tech] Cache Files - Always look for new

CAUTION: This e-mail originated outside the University of Southampton.
Hi All,

A user uploaded a file to our data repository, opened it, noticed a mistake, deleted the file and reuploaded the new file. When they click the link and the pdf opens in the browser it opens the original file because, I assume, it's been cached.

This happens rarely and when it does we ask the user to refresh the page with the document or do a ctrl+f5 refresh to clear the cache for that page. In this instance the user is insisting that they couldn't possibly ask this of the people they had already shared the link with.

I've made changed to my apache ssl conf to include:

<FilesMatch ".(js|css|jpg|jpeg|png|gif|js|css|ico|swf|pdf|html)$">
  <IfModule mod_headers.c>
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header unset Last-Modified
  </IfModule>
  </FilesMatch>

I am not an apache expert by any stretch of the imagination. After restarting apache this has not resolved the issue. Can anybody advise? Maybe there is a specific EPrints THING I need to be aware of? We're on EPrints 3.4.4.

Thanks,
James


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20230504/d631ce93/attachment-0001.html