goplus / builder

Go+ Builder
https://builder.goplus.org
18 stars 18 forks source link

Browser cache problem with signed URLs #500

Open aofei opened 1 month ago

aofei commented 1 month ago

Description

Switching from public URLs to signed URLs causes caching issues. Browsers see different URLs each time because of parameters like expires and token, leading to re-downloads of the same file.

Workaround

In #497, we sign URLs using the current UTC day and set the expiration to 2 days. This makes URLs consistent within the same day.

Possible solutions

  1. Moving signing info to request headers.
  2. Using service workers to implement a custom caching mechanism.
ComfyFluffy commented 1 month ago

https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#vary

只有在 Vary 中指定的 header 会和 URL 一起作为缓存的 key