[GH-ISSUE #526] ETag and Last-Modified does not work correctly on Microsoft Edge if Cache-Control: no-cache is not present in response header #305

Closed
opened 2026-04-08 16:51:52 +03:00 by zhus · 1 comment
Owner

Originally created by @hucsmn on GitHub (Jan 13, 2025).
Original GitHub issue: https://github.com/sigoden/dufs/issues/526

Problem

Browse a dufs directory list view on Microsoft Edge (131.0.2903.146), click to download arbitary file.
Then modify the file content, and click to download again.
The second downloaded file will keep its content unchanged, which is unexpected.

This behavior could not be reproduced on Google Chrome (131.0.6778.265).

I have tried to add a Cache-Control: no-cache response header in fn handle_send_file():

diff --git a/src/server.rs b/src/server.rs
index 2c59a3a..1e9ce09 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -838,6 +838,7 @@ impl Server {
                 }
             }

+            res.headers_mut().typed_insert(CacheControl::new().with_no_cache());
             res.headers_mut().typed_insert(last_modified);
             res.headers_mut().typed_insert(etag.clone());


After clearing browser cache, the above unwanted behavior become irreproducible on Microsoft Edge.

Configuration

Default dufs configuration.

Environment Information

  • Dufs version: 0.43.0
  • Browser/Webdav info: Microsoft Edge 131.0.6778.265 (User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0)
  • OS info: Windows 10
Originally created by @hucsmn on GitHub (Jan 13, 2025). Original GitHub issue: https://github.com/sigoden/dufs/issues/526 **Problem** Browse a dufs directory list view on Microsoft Edge (131.0.2903.146), click to download arbitary file. Then modify the file content, and click to download again. The second downloaded file will keep its content unchanged, which is unexpected. This behavior could not be reproduced on Google Chrome (131.0.6778.265). I have tried to add a `Cache-Control: no-cache` response header in `fn handle_send_file()`: ```diff diff --git a/src/server.rs b/src/server.rs index 2c59a3a..1e9ce09 100644 --- a/src/server.rs +++ b/src/server.rs @@ -838,6 +838,7 @@ impl Server { } } + res.headers_mut().typed_insert(CacheControl::new().with_no_cache()); res.headers_mut().typed_insert(last_modified); res.headers_mut().typed_insert(etag.clone()); ``` After clearing browser cache, the above unwanted behavior become irreproducible on Microsoft Edge. **Configuration** Default dufs configuration. **Environment Information** - Dufs version: 0.43.0 - Browser/Webdav info: Microsoft Edge 131.0.6778.265 (User-Agent: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0`) - OS info: Windows 10
zhus closed this issue 2026-04-08 16:51:52 +03:00
Author
Owner

@sigoden commented on GitHub (Jan 17, 2025):

I couldn't reproduce the issue you mentioned in Edge browser.

But it is a good practice to set cache-control:no-cache for data that may be dynamic, and I am still going to add a PR to support it.

<!-- gh-comment-id:2598283971 --> @sigoden commented on GitHub (Jan 17, 2025): I couldn't reproduce the issue you mentioned in Edge browser. But it is a good practice to set cache-control:no-cache for data that may be dynamic, and I am still going to add a PR to support it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sigoden/dufs#305