Comments (1)
Thanks for raising this issue @MarcoPolo
The problem I mentioned was browsers blocking only-if-cached
in cross-origin requests. There was some back and forth around this (whatwg/fetch#159, whatwg/fetch#295) and https://fetch.spec.whatwg.org states:
"only-if-cached"
Fetch uses any response in the HTTP cache matching the request, not paying attention to staleness. If there was no response, it returns a network error. (Can only be used when request’s mode is "same-origin". Any cached redirects will be followed assuming request’s redirect mode is "follow" and the redirects do not violate request’s mode.)
Thing to confirm to check if setting Access-Control-Allow-Headers
lifts the "Can only be used when request’s mode is same-origin" limitation in all browsers (Chromium, Firefox, Safari) and allows example.com
to do cross-origin fetch from ipfs.io
.
If setting Access-Control-Allow-Headers
is enough, I agree, we should document it in the spec. I think we need a dedicated CORS section in "Notes for implementers" anyway (some prior art in /routing/v1 spec)
If it is not enough, then we may need IPFS-specific solution, probably a dedicated HTTP header Ipfs-Cache-Control
and URL query parameter for controlling the cache behavior beyong HTTP semantics ('get', 'has' 'get-only-if-has'). But would be nicer if we don't need this.
@MarcoPolo Would you have time to check current state of only-if-cached
and open a PR to update specs to make it work?
We would then apply fix in boxo/gateway and add conformance tests to https://github.com/ipfs/gateway-conformance.
from specs.
Related Issues (20)
- gateway: add CORS to specs
- gateway: CDN-Loop
- gateway: batching raw block requests (AKA userland traversal of DAGs with unknown codecs)
- IPNS Publisher Key Seed Phrases
- Add specification for Web Pathing
- Gateway: define a protocol.ID for the gateway protocol. HOT 2
- Remove Kubo (userland) specifications
- WebSeed specifications HOT 1
- specs.ipfs.tech uses absolute URLs for links, assets
- New IPNS key types HOT 3
- _redirects spec clarification
- website: link to conformance.ipfs.tech from specs.ipfs.tech
- gateway: run Unicode Normalisation Forms on path gateway inputs HOT 2
- bug: accept header vs format query param precedence
- IPIP: path gateway - range requests clarification (nit) HOT 1
- bug: spec contradiction
- http response header for gateways: alt-svc HOT 1
- IPNS: clarify serialization and the type of ValidityType, TTL and Seq fields
- IPNS: protocol specification doesn't indicate dnsLink domain is valid as "domain" in "ipns://domain" URI
- [Feature Request]: Add IPFS Loopback Functionality HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from specs.