Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue (cache-control: no-cache) #498

Open
Saiv46 opened this issue Mar 19, 2024 · 0 comments
Open

Performance issue (cache-control: no-cache) #498

Saiv46 opened this issue Mar 19, 2024 · 0 comments
Assignees

Comments

@Saiv46
Copy link

Saiv46 commented Mar 19, 2024

Symptom:

Nimiq Keyguard takes some time to load and display password prompt on every occurrence.

Reason:

Each of following URLs is being downloaded 5(!) times each time Nimiq Hub is opened:

https://keyguard.nimiq.com/assets/nimiq/worker.js
https://keyguard.nimiq.com/assets/nimiq/worker-wasm.js
https://keyguard.nimiq.com/assets/nimiq/worker-wasm.wasm

The problem is with Cache-Control: no-cache, must-revalidate, despite backend supporting (and sending) ETag and Last-modified headers, browsers will not even try to make conditional request to revalidate cache (as described for Request.cache).

Possible solutions:

  1. Updating WasmHelper.js to use fetch() instead of XHR.
  2. Fix Service Worker own caching to actually make it offline-capable.
  3. Setting Cache-Control: max-age=60, must-revalidate should resolve this issue. CDN-Cache-Control could be used alongside.
@sisou sisou assigned sisou and curdbecker and unassigned sisou Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants