-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add etag and other caching headers to all content addressed gets in api #3543
Comments
An easy way to demonstrate the browser's non caching behaviour, even with the correct etag header present is |
After talking to a chromium engineer it turns out this is by design. Pressing enter in the url bar, or F5 will ignore the cache, even if the url is set to cache for a year with immutable and etag set. It should be returned from cache when called within a page, either as an ajax call or as a subresource. So it really is just a matter of setting the same headers on object calls. |
I agree, we could provide significant optimization by adding
However,
|
We no longer use the object api, but have replaced it with the block api, but the same thing applies there. |
We discussed this during Friday issue triage and decided these additional HTTP semantics do not belong under
In short: if one needs caching of RPC API call responses, then it needs to happen at application level. Note that HTTP cache control is already supported on gateway's @ianopolous is getting JSON representation of directory listing the only reason for filling this issue? I believe we could add support for returning JSON instead of HTML for dir listings |
Version information:
N/A
Type: Enhancement
Priority:
P3
Description:
After discussion in irc, I'm submitting this feature request. The origin of this requirement is the following: Previously we've had our own http api for Peergos with caching working fine, but now we're trying to move to match IPFS' http api to allow us to self host from within IPFS. However it seems that the object api currently doesn't include etag headers and are not cached. Local tests however would suggest that even including them will not make the browser (chrome only tested) cache the requests. My guess is that the hash will need to be included in the path, rather than the query to get the caching working.
e.g. https://ipfs.io/api/v0/object/get?stream-channels=true&arg=QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D
Currently we are using solely the ipfs object api (get, data, and the writing calls new, addLink, setData) However, I'd like to migrate to the simpler dag api, once it supports cbor, but it seems to have the same problem.
The text was updated successfully, but these errors were encountered: