Boundary node http response headers

To whom it may concern: I’ve been working with Daniel to try to figure out this strange safari issue where I can’t get our video to play from our canister. If I run a local version of the icx-proxy and point it at ic0.app I can get my video to play at http://localhost:3000/-/1/ex?canisterId=r5m5i-tiaaa-aaaaj-acgaq-cai but if I call the same thing at https://r5m5i-tiaaa-aaaaj-acgaq-cai.raw.ic0.app/-/1/ex the video does not play.

In both cases, safari stops the request when it sees ‘video’ in the content type and sends a new range request asking for the first two bytes. When I go through a local proxy that range request gets through(It is a header on the request (Range: bytes=0-1). When I go straight to raw.ic0.app Safari says that it is sending the header, but i’ve manipulated my server to return the actual headers that I’m getting and the range request is not there. So either Safari is lying(Daniel thinks so) or something is stripping off the range request on the way to my canister. I don’t know the topgraphy of where a request actually goes, but I suspect there is a boundary node and a proxy?

Request - through local version of icx-proxy
GET /-/1/ex HTTP/1.1
Accept: */*
Connection: Keep-Alive
Range: bytes=0-1
Host: localhost:3000
Accept-Language: en-US,en;q=0.9
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15
Referer: http://localhost:3000/-/1/ex?canisterId=r5m5i-tiaaa-aaaaj-acgaq-cai
Accept-Encoding: identity
X-Playback-Session-Id: 6FFA5EE3-52F6-4DDC-8297-300A4C22A9DF

Response
HTTP/1.1 206 Partial Content
Content-Range: bytes 0-1/46984888
Accept-Ranges: bytes
Content-Type: video/mp4
Content-Length: 2
Date: Thu, 21 Apr 2022 22:58:16 GMT


Request 2 - through raw.ic0.app
GET /-/1/ex
Range: bytes=0-1
Accept: */*
Referer: https://r5m5i-tiaaa-aaaaj-acgaq-cai.raw.ic0.app/-/1/ex
Accept-Encoding: identity
Connection: Keep-Alive
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15
X-Playback-Session-Id: 62FA3A12-FD2A-4C34-839A-B6963DCFC6F1

Actual headers that get to my canister
[("host", "r5m5i-tiaaa-aaaaj-acgaq-cai.raw.ic0.app"), 
("x-real-ip", "108.230.245.93"), 
("x-forwarded-for", "108.230.245.93"), 
("x-forwarded-proto", "https"), ("connection", "close"), 
("user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15"), ("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"),
 ("accept-language", "en-US,en;q=0.9"), 
("accept-encoding", "gzip, deflate, be")]

Response:
200
Access-Control-Allow-Credentials: true
Content-Type: video/mp4
Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS
Access-Control-Expose-Headers: Content-Length,Content-Range
Access-Control-Allow-Origin: *
Date: Thu, 21 Apr 2022 22:56:06 GMT
Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Cookie
Server: nginx/1.21.3
x-cache-status: MISS

This thread confirms my suspicions.

Looks like the short term solution is to set up a server running icx-proxy that can server your requests. So @lastmjs you could set up stream.demergence.com/episode-tag?canisgerId=xxxxxxxxxxxxx and it would work.

As far as certified assets go, range requests allow you to return the results you want vs. what was requested, so if you certified 1MB chunks you could always return at least that chunk. If it requests something in the middle of a chunk, rewind to the earliest certified starting point and return the chunk. maybe the chunks need to be smaller, but since safari requests them in order and the latency is pretty bad it can take along time to download large files.

A bit irrelevant as it seems like icx-proxy does not certify data anyway (but it would be great to have confirmation at Can the icx-proxy return certified assets?

1 Like