IPFS returning car file instead of raw file

I am running a Kubo node and using it to serve files over a gateway
Sometimes it will randomly return a car file instead of the file I am trying to access
Any idea why this happens?

Can you show the requests you are doing and tell more about what your architecture is please.

My first guess would be some caching layer that does not add the Accept header as part of the cache key so if someone sent you a car request first, car gets cached then next person inline wants the file, has different Accept header but your cache doesn’t check that and send back car instead of plain file.

I have my kubo nodes deployed in k8s and i have a bunnycdn pullzone in front of that that caches most requests
I am using the ipfs gateway to deploy a site but sometimes it randomly returns a car file instead of the website

any idea why this might be happening?

Could it be that the CID you are fetching was added a CAR that was then encoded as a UnixFS file?

Alternatively, it could be that bunnycdn is not taking the Accept header into account.

Hey @danieln, just following above in the conversation above. The issue we are seeing is where we have cloudflare workers that does not cache anything, but rather cache response from nginx seems to be the issue. one thing strange is, sometimes site is served fine, but when I hit refresh, it starts to download as CAR. we do upload the dist directory of the site as CAR tho.

Can you provide a reproduction for this so that we can confirm if this is indeed a bug?

Or provide a URL to test this out?

Hey, thanks for getting. it was indeed an nginx cache issue. the first request made was car file and then subsequent would just return car due to nginx caching we set up

1 Like