# IPFS returning car file instead of raw file

**URL:** <https://discuss.ipfs.tech/t/ipfs-returning-car-file-instead-of-raw-file/17528>\
**Category:** Kubo\
**Tags:** files\
**Created:** [February 4, 2024, 7:59pm UTC](https://discuss.ipfs.tech/t/ipfs-returning-car-file-instead-of-raw-file/17528 "2024-02-04T19:59:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![utibeabasi6](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/utibeabasi6/32/8348_2.png) [@utibeabasi6](https://discuss.ipfs.tech/u/utibeabasi6)\
**Post date:** [February 4, 2024, 7:59pm UTC](https://discuss.ipfs.tech/t/ipfs-returning-car-file-instead-of-raw-file/17528/1 "2024-02-04T19:59:57Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Jorropo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/jorropo/32/3230_2.png) [@Jorropo](https://discuss.ipfs.tech/u/Jorropo)\
**Post date:** [February 5, 2024, 12:29am UTC](https://discuss.ipfs.tech/t/ipfs-returning-car-file-instead-of-raw-file/17528/2 "2024-02-05T00:29:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![utibeabasi6](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/utibeabasi6/32/8348_2.png) [@utibeabasi6](https://discuss.ipfs.tech/u/utibeabasi6)\
**Post date:** [February 5, 2024, 2:07pm UTC](https://discuss.ipfs.tech/t/ipfs-returning-car-file-instead-of-raw-file/17528/3 "2024-02-05T14:07:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![utibeabasi6](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/utibeabasi6/32/8348_2.png) [@utibeabasi6](https://discuss.ipfs.tech/u/utibeabasi6)\
**Post date:** [February 6, 2024, 4:00pm UTC](https://discuss.ipfs.tech/t/ipfs-returning-car-file-instead-of-raw-file/17528/4 "2024-02-06T16:00:57Z")

</div>

any idea why this might be happening?  
@Jorropo

---

<div class="post-metadata">

**Author:** ![danieln](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/danieln/32/6408_2.png) [@danieln](https://discuss.ipfs.tech/u/danieln)\
**Post date:** [February 7, 2024, 11:01am UTC](https://discuss.ipfs.tech/t/ipfs-returning-car-file-instead-of-raw-file/17528/5 "2024-02-07T11:01:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![theBeardA](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/thebearda/32/6494_2.png) [@theBeardA](https://discuss.ipfs.tech/u/theBeardA)\
**Post date:** [March 11, 2024, 9:33pm UTC](https://discuss.ipfs.tech/t/ipfs-returning-car-file-instead-of-raw-file/17528/6 "2024-03-11T21:33:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![danieln](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/danieln/32/6408_2.png) [@danieln](https://discuss.ipfs.tech/u/danieln)\
**Post date:** [March 12, 2024, 10:32am UTC](https://discuss.ipfs.tech/t/ipfs-returning-car-file-instead-of-raw-file/17528/7 "2024-03-12T10:32:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![theBeardA](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/thebearda/32/6494_2.png) [@theBeardA](https://discuss.ipfs.tech/u/theBeardA)\
**Post date:** [March 13, 2024, 7:26pm UTC](https://discuss.ipfs.tech/t/ipfs-returning-car-file-instead-of-raw-file/17528/8 "2024-03-13T19:26:11Z")

</div>

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
