[PR #2182] [MERGED] Set Expires header when caching responses #3296

Closed
opened 2025-10-09 18:20:43 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/2182
Author: @RealOrangeOne
Created: 12/28/2021
Status: Merged
Merged: 12/30/2021
Merged by: @dani-garcia

Base: mainHead: cache-expires-header


📝 Commits (4)

  • 4584cfe Additionally set expires header when caching responses
  • 248e7da Collapse field name definition
  • 690d0ed Add our own HTTP date formatter
  • 6ddbe84 Remove unnecessary return

📊 Changes

3 files changed (+84 additions, -40 deletions)

View changed files

📝 src/api/icons.rs (+7 -2)
📝 src/api/web.rs (+28 -25)
📝 src/util.rs (+49 -13)

📄 Description

Browsers are rather smart, but also dumb. This uses the Expires header
alongside cache-control to better prompt the browser to actually
cache.

Unfortunately, firefox still tries to "race" its own cache, in an
attempt to respond to requests faster, so still ends up making a bunch
of requests which could have been cached. Doesn't appear there's any way
around this.

See also https://github.com/dani-garcia/vaultwarden/issues/1453#issuecomment-1002115973


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/2182 **Author:** [@RealOrangeOne](https://github.com/RealOrangeOne) **Created:** 12/28/2021 **Status:** ✅ Merged **Merged:** 12/30/2021 **Merged by:** [@dani-garcia](https://github.com/dani-garcia) **Base:** `main` ← **Head:** `cache-expires-header` --- ### 📝 Commits (4) - [`4584cfe`](https://github.com/dani-garcia/vaultwarden/commit/4584cfe3c18820d8235628cdf629655abd601bc7) Additionally set expires header when caching responses - [`248e7da`](https://github.com/dani-garcia/vaultwarden/commit/248e7dabc2e389ac67e77c1c6078259c29b7f997) Collapse field name definition - [`690d0ed`](https://github.com/dani-garcia/vaultwarden/commit/690d0ed1bb3c9d3b22e3b50aebbcd4bb3b3764d0) Add our own HTTP date formatter - [`6ddbe84`](https://github.com/dani-garcia/vaultwarden/commit/6ddbe84bde04c7ec8b52e9641b490adedd8b22a2) Remove unnecessary return ### 📊 Changes **3 files changed** (+84 additions, -40 deletions) <details> <summary>View changed files</summary> 📝 `src/api/icons.rs` (+7 -2) 📝 `src/api/web.rs` (+28 -25) 📝 `src/util.rs` (+49 -13) </details> ### 📄 Description Browsers are rather smart, but also dumb. This uses the `Expires` header alongside `cache-control` to better prompt the browser to actually cache. Unfortunately, firefox still tries to "race" its own cache, in an attempt to respond to requests faster, so still ends up making a bunch of requests which could have been cached. Doesn't appear there's any way around this. See also https://github.com/dani-garcia/vaultwarden/issues/1453#issuecomment-1002115973 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2025-10-09 18:20:43 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#3296