CORS and cache issues with Block GETs #121
Labels
kind/bug
A bug in existing code (including security flaws)
need/triage
Needs initial labeling and prioritization
I'm using the
Accept: application/vnd.ipld.block
feature of the gateway in order to download a single block for a root of a file tree.The initial issue I was having was with cache-enabled requests not being able to load blocks. Specifically, it was happening in Node.js' built in undici API.
Running the above in chrome devtools yields
application/vnd.ipld.car
when running from chrome devtools, but yieldstext/plain; charset=ISO-8859-1
when in Node.js.Setting the
cache
parameter tono-cache
fixes it which leads me to think it's something to do with caching.In Firefox, when I try to trigger the request from the devtools, it all works correctly, however when I do so with code I get a CORS error for the preflight request.
Yields
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://w3s.link/ipfs/bafybeic3zi46caikdvukly7xwnjrecbvmllafvopvlyw6ylt3oeht7h5om/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 500.
with the following response headers:It feels like there might be something funky going on with CORS not being set? I'm a little stuck as to how I could work around this. 😅 It really looks like it's just preflight requests that aren't working.
The text was updated successfully, but these errors were encountered: