funmiles.
CDCloudflare Developers
•Created by funmiles. on 9/4/2024 in #general-help
`fetch(this.url, { method: 'HEAD' });` returns -1 for `content-length`
Asking for a range starting from 1MB down gives the same thing. It looks like until a download is initiated, the headers are totally ignored.
11 replies
CDCloudflare Developers
•Created by funmiles. on 9/4/2024 in #general-help
`fetch(this.url, { method: 'HEAD' });` returns -1 for `content-length`
Stranger behavior still: If I try to fetch a range of the file for the first 1MB, fetch succeeds but the ArrayBuffer has the length of the whole file.
11 replies
CDCloudflare Developers
•Created by funmiles. on 9/4/2024 in #general-help
`fetch(this.url, { method: 'HEAD' });` returns -1 for `content-length`
@Erisa I saw that after pasting. So it does not return a size at all. Which is still not the desired result. What other way is there to obtain the size of a file without downloading it?
11 replies
CDCloudflare Developers
•Created by funmiles. on 9/4/2024 in #general-help
`fetch(this.url, { method: 'HEAD' });` returns -1 for `content-length`
So it feels as if maybe the file is compressed on cloudflare and they do not give the size, but once it's been downloaded, it caches the size?
11 replies
CDCloudflare Developers
•Created by funmiles. on 9/4/2024 in #general-help
`fetch(this.url, { method: 'HEAD' });` returns -1 for `content-length`
The file is there and readable, since it can be downloaded and once downloaded, reloading the page reruns the above code and it works.
11 replies
CDCloudflare Developers
•Created by funmiles. on 9/4/2024 in #general-help
`fetch(this.url, { method: 'HEAD' });` returns -1 for `content-length`
@Erisa It works from the development server but not once deployed.
11 replies
CDCloudflare Developers
•Created by funmiles. on 9/4/2024 in #general-help
`fetch(this.url, { method: 'HEAD' });` returns -1 for `content-length`
You can see the log prints
11 replies
CDCloudflare Developers
•Created by funmiles. on 9/4/2024 in #general-help
`fetch(this.url, { method: 'HEAD' });` returns -1 for `content-length`
Here are the lines:
11 replies