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

browser caches all responses of same url regardless Content-Type #250

Open
harunurhan opened this issue Apr 10, 2019 · 1 comment
Open

Comments

@harunurhan
Copy link
Member

When you rely on Content-Type and different serializers of same record to serve different formats under same url, you might have caching issues on most of the browsers. Because invenio sets Last-Modified and Etag based on only record's version.

So it's likely that browser will reply with a different format to requests that has the same url. For example application/json instead of application/x-bibtex, because of same Etag and Last-Modified

Quick workaround would be remove Last-Modified and put Etag that includes both version and Content-Type.

@equadon
Copy link
Contributor

equadon commented Nov 19, 2019

After discussion with Lars

Current implementation

#273

We cannot use an ETag which uses both the revision id and content-type with the current implementation since ETag are used both as a caching mechanism and for concurrency control. For caching it works:

  1. Create record
  2. GET xml
  3. GET json

will get you the right content and caching works.

However, if you do:

  1. Create record
  2. GET xml
  3. GET json
  4. PUT and update record

This probably will fail (please verify) and we need to find a solution that separates these concerns.

Suggestions on where to go next

  • Investigate if strong vs. weak ETags could be a solution
  • Find a way to separate ETag usage for caching and concurrency control
  • Ensure that check_etag works correctly with weak and strong ETags
  • Now strong ETags are used by default - investigate if weak should be used by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

5 participants