ipfs / ipfs/specs

IPFS Gateway not exposing content-length header when receiving Accept-Encoding

Open
#281 6 comments 0 reactions 0 assignees View on GitHub
need/triage
Dominant language
HTML
Stars
1.2k
Forks
247
Avg merge
5d 21h
Merged PRs (30d)
4

Description

At the moment IPFS Gateway does not send content-length header in response when it receives Accept-encoding headers. This is problematic for caching that can only be performed when we know content-length and browsers fetch default to send such headers.

Taking into account https://ipfs.io/ipfs/bafybeib4zuumguq4cgkt7caddeukb4ysijnehvntekrtu5afmet5ujvlka/package.json , we get content-length with CURL, but not browser.

image
image

@lidel found out that Accept-Encoding request header was the root problem.

```sh
curl -sD - https://ipfs.io/ipfs/bafybeib4zuumguq4cgkt7caddeukb4ysijnehvntekrtu5afmet5ujvlka/package.json | grep -i content-length
```

```sh
curl -sD - -H 'Accept-Encoding: gzip' https://ipfs.io/ipfs/bafybeib4zuumguq4cgkt7caddeukb4ysijnehvntekrtu5afmet5ujvlka/package.json | grep -i content-length
```

References:
- https://github.com/protocol/bifrost-infra/issues/1868
- https://github.com/nftstorage/nftstorage.link/pull/98
- https://github.com/metacpan/metacpan-api/issues/240#issuecomment-10258159

cc @lidel @thattommyhall @gmasgras

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.