# Ic-gateway issue ? Content-range header

**URL:** <https://forum.dfinity.org/t/ic-gateway-issue-content-range-header/63187>\
**Category:** Developers\
**Created:** [January 23, 2026, 1:33pm UTC](https://forum.dfinity.org/t/ic-gateway-issue-content-range-header/63187 "2026-01-23T13:33:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gwojda](https://avatars.discourse-cdn.com/v4/letter/g/5fc32e/32.png) [@Gwojda](https://forum.dfinity.org/u/Gwojda)\
**Post date:** [January 23, 2026, 1:33pm UTC](https://forum.dfinity.org/t/ic-gateway-issue-content-range-header/63187/1 "2026-01-23T13:33:04Z")

</div>

Hey,  
I’m facing right now with an issue with range header, (i used a random pictures i had, \>2Mb here : [https://4lfpx-eqaaa-aaaag-aujna-cai.raw.icp0.io/icrc3.png](https://4lfpx-eqaaa-aaaag-aujna-cai.raw.icp0.io/icrc3.png)) for example, it was working before but for some reason it looks like the ic gateway is returning bad stuff on the range header.

```auto
curl -I "https://4lfpx-eqaaa-aaaag-aujna-cai.raw.icp0.io/icrc3.png" 2>&1
HTTP/2 200
content-length: 2000000
curl: (16) Invalid HTTP header field was received: frame type: 1, stream: 1, name: [content-length], value: [2535142]

```

We receive 2 content-length header, one wrong and one correct.  
Can you help here?

Note that locally, it seems to work correctly according to what i heard.

---

<div class="post-metadata">

**Author:** ![rbirkner](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@rbirkner](https://forum.dfinity.org/u/rbirkner)\
**Post date:** [January 23, 2026, 2:18pm UTC](https://forum.dfinity.org/t/ic-gateway-issue-content-range-header/63187/2 "2026-01-23T14:18:38Z")

</div>

Hey @Gwojda,

I see the two headers you are mentioning:

(1) Set by the canister

```auto
content-length
2000000

```

(2) Set by the HTTP gateway

```auto
content-length
2535142

```

But to dig deeper, I need to understand better what you are doing. You are writing a canister that returns streaming response (partial assets with range headers), right? You set the content-length.

---

<div class="post-metadata">

**Author:** ![Gwojda](https://avatars.discourse-cdn.com/v4/letter/g/5fc32e/32.png) [@Gwojda](https://forum.dfinity.org/u/Gwojda)\
**Post date:** [January 23, 2026, 2:27pm UTC](https://forum.dfinity.org/t/ic-gateway-issue-content-range-header/63187/3 "2026-01-23T14:27:51Z")

</div>

Thanks. It’s a storage canister that serve asset on http endpoint. you can check here : [ic-storage-canister/canister/src at master · BitySA/ic-storage-canister · GitHub](https://github.com/BitySA/ic-storage-canister/tree/master/canister/src) and here for how assets are served : [ic-storage-canister/canister/src/queries/http\_request.rs at master · BitySA/ic-storage-canister · GitHub](https://github.com/BitySA/ic-storage-canister/blob/master/canister/src/queries/http_request.rs). I’m 99% sure it was working before, i’m pretty sure i tested like few months ago with a big videos and a big pictures. No update on ic-asset libs btw since a long time.

---

<div class="post-metadata">

**Author:** ![Gwojda](https://avatars.discourse-cdn.com/v4/letter/g/5fc32e/32.png) [@Gwojda](https://forum.dfinity.org/u/Gwojda)\
**Post date:** [January 28, 2026, 2:08pm UTC](https://forum.dfinity.org/t/ic-gateway-issue-content-range-header/63187/4 "2026-01-28T14:08:15Z")

</div>

any updates? Thanks Thanks

---

<div class="post-metadata">

**Author:** ![Gwojda](https://avatars.discourse-cdn.com/v4/letter/g/5fc32e/32.png) [@Gwojda](https://forum.dfinity.org/u/Gwojda)\
**Post date:** [February 11, 2026, 7:57am UTC](https://forum.dfinity.org/t/ic-gateway-issue-content-range-header/63187/5 "2026-02-11T07:57:09Z")

</div>

Hey @rbirkner,  
Any update here ? I saw some new update has been done here, but it’s looks like the issue is still there, even after update on my side.

I just use ic-asset-certification, so if the issue is on canister side, i guess it’s related with an error here

> <https://github.com/BitySA/ic-storage-canister/blob/master/canister/src/types/http.rs#L226>

> <https://github.com/BitySA/ic-storage-canister/blob/master/canister/src/queries/http_request.rs#L27>

---

<div class="post-metadata">

**Author:** ![Gwojda](https://avatars.discourse-cdn.com/v4/letter/g/5fc32e/32.png) [@Gwojda](https://forum.dfinity.org/u/Gwojda)\
**Post date:** [February 11, 2026, 8:33am UTC](https://forum.dfinity.org/t/ic-gateway-issue-content-range-header/63187/6 "2026-02-11T08:33:57Z")

</div>

Ok, i think i found the bug.  
using [xxx.icp0.io/xxx](http://xxx.icp0.io/xxx) It’s working correctly. Using [xxx.raw.icp0.io/xxx](http://xxx.raw.icp0.io/xxx) it’s not. The problem is here :  
[http-gateway/packages/ic-http-gateway/src/protocol/handler.rs at main · dfinity/http-gateway · GitHub](https://github.com/dfinity/http-gateway/blob/main/packages/ic-http-gateway/src/protocol/handler.rs#L276)

I guess we should do same as later in the code :

```rust
None => {
    for HeaderField(name, value) in &agent_response.headers {
        if !is_range_request
            && status_code == 206
            && (name.eq_ignore_ascii_case(http_header::CONTENT_RANGE.as_ref())
                || name.eq_ignore_ascii_case(http_header::CONTENT_LENGTH.as_ref()))
        {
            // skip copying
        } else {
            response_builder = response_builder.header(name.as_ref(), value.as_ref());
        }
    }
}

```

What do you think @rbirkner ?  
I can open the pr if you want.

Edit : [No certify assets streaming issue by Gwojda · Pull Request #61 · dfinity/http-gateway · GitHub](https://github.com/dfinity/http-gateway/pull/61)

---

<div class="post-metadata">

**Author:** ![rbirkner](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@rbirkner](https://forum.dfinity.org/u/rbirkner)\
**Post date:** [February 13, 2026, 12:56pm UTC](https://forum.dfinity.org/t/ic-gateway-issue-content-range-header/63187/7 "2026-02-13T12:56:07Z")

</div>

Hi @Gwojda

Sorry for the late reply! Thanks a lot for looking into it and coming up with a solution. At the moment, we just didn’t have the bandwidth to dig that deep.

We will review the PR and then make sure it gets deployed.
