You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please use the 馃憤 reaction to show that you are interested into the same feature.
Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
Subscribe to receive notifications on status change and new comments.
Is your feature request related to a problem? Please describe.
When sharing a file or folder via a public link, Nextcloud serves the download in a way that does not enable functioning caching. It sets cache-control: must-revalidate, post-check=0, pre-check=0, which asks browsers to revalidate each request (which could be okay), but it does not set last-modified or etag, and it does not respect if-modified-since or if-none-match requests.
For an image file preview of a public share, caching works: cache-control includes a max-age, the last-modified response header gives the date the preview was first requested (I assume), and conditional requests with a recent enough if-modified-since return status 304.
(On a side note, "pragma: no-cache" in the response is deprecated, and "post-check" and "pre-check" were never standardized in the "cache-control" header.)
Describe alternatives you've considered
My use case is to embed shared files in web pages. The alternative would be to set up a web server to serve static files. Using Nextcloud to do so is not very efficient, but can be handy. For this, it would be useful to avoid needless re-requests of downloads by clients.
Additional context
Simulation of getting a preview URL for the first time:
How to use GitHub
Is your feature request related to a problem? Please describe.
When sharing a file or folder via a public link, Nextcloud serves the download in a way that does not enable functioning caching. It sets
cache-control: must-revalidate, post-check=0, pre-check=0
, which asks browsers to revalidate each request (which could be okay), but it does not setlast-modified
oretag
, and it does not respectif-modified-since
orif-none-match
requests.For an image file preview of a public share, caching works:
cache-control
includes amax-age
, thelast-modified
response header gives the date the preview was first requested (I assume), and conditional requests with a recent enoughif-modified-since
return status 304.(On a side note, "pragma: no-cache" in the response is deprecated, and "post-check" and "pre-check" were never standardized in the "cache-control" header.)
Describe the solution you'd like
The
PublicPreviewController
uses aFileDisplayResponse
to serve the file preview with proper cache control.Something similar would be nice for the ShareController. That is, instead of forbidding caching in sendHeaders, set the
last-modified
header to the file modification date and possibly set anetag
, and return a 304 response ingetSingleFile
when appropriate.Describe alternatives you've considered
My use case is to embed shared files in web pages. The alternative would be to set up a web server to serve static files. Using Nextcloud to do so is not very efficient, but can be handy. For this, it would be useful to avoid needless re-requests of downloads by clients.
Additional context
Simulation of getting a preview URL for the first time:
Simulation of getting a preview URL for the second time:
(followed by all the same headers as before)
Getting a download URL:
Adding an
if-modified-since
to the last request does not change the outcome.The text was updated successfully, but these errors were encountered: