BUG: Partial requests for cached files occasionally results in a 200 response with the full contents

I have some files that I’m hosting on backblaze b2 and caching by using a “cache everything” page rule.

My access pattern is that I’m only ever requesting small ranges of bytes at a time.

Initially I was worried that the CDN would not support caching when making partial requests using byte-range headers, but it actually seems to work very well. The only thing that isn’t great is that the request will block, presumably, for as long as it takes for the CDN to download the full file before servicing the request.

The problem I’m having is that every once in a while the server will respond to my partial request with a 200 instead of a 206 response and return the full contents of the file.

This is pretty strange, and almost seems like there might be a CDN node that’s not behaving the same as the others?

It’s obviously not ideal for my client side app to suddenly freeze and download hundreds of megabytes of data.

In case it’s helpful these are the headers for the rogue request/response:

Request headers:

DNT: 1
Range: bytes=10825728-10891263
Referer: mydomain
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36

Response headers:

accept-ranges: bytes
access-control-allow-credentials: true
access-control-allow-origin: mydomain
age: 2720
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
cache-control: max-age=14400
cf-cache-status: HIT
cf-ray: 6fae120f8fac7447-LHR
content-length: 348270592
content-type: application/octet-stream
date: Tue, 12 Apr 2022 18:36:58 GMT
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
last-modified: Tue, 12 Apr 2022 17:51:38 GMT
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=nJHvdB%2BoGgIc92OLvM6nquDYwtefQWJVlL7scHA77OHNyAx7TuAWtgf2qnMM%2F%2B40dYgrJszz7Lg6ZEiqgPrWR3%2BNosQb7%2FsyZobVBHRR7yxJVPuKnJqm0UzxPB2Xbg0KA1xsd10wUSMtiww%3D"}],"group":"cf-nel","max_age":604800}
server: cloudflare
vary: origin, access-control-request-method, access-control-request-headers, Accept-Encoding
x-bz-content-sha1: none
x-bz-file-id: 4_zc817b03135a21b918f04091c_f202a35e0ad12a570_d20220412_m031118_c004_v0402000_t0024_u01649733078130
x-bz-file-name: db.2.sqlite
x-bz-info-src_last_modified_millis: 1649732923585
x-bz-upload-timestamp: 1649733078130

Any ideas on what’s going on or insights into caching behaviour with partial requests greatly appreciated.

Hi @johtso

I was able to replicate this.

I also noticed that Cloudflare doesn’t support the range requests that contain 2 parts and one being a last bytes for example: “Range: 0-1024, -32” which means get the first 1024 bytes and the last 32 bytes of the file. For such range requests is consistently returns the entire file when spec says that if the server cannot satisfy the request it should be rejected, not returned incorrectly.

1 Like

Please open a ticket that describes the situation and how to replicate the issue (a HAR file is best). A link to this thread would also help. Tickets are in the dashboard or support AT cloudflare DOT com, and post the ticket # here so we can escalate it.

2 Likes

Thanks! The ticket ID is #2425088

2 Likes

Thanks. I’ve added that ticket to the escalation queue. Someone will probably take a look at it this week.

1 Like

Hello

As per the response in the ticket, if the issue returns, please attempt to capture a HAR which we can review further.

1 Like

Was the issue actually identified and fixed? Or are you just saying more samples are required before anyone will make an effort to look at it?

I wasn’t included in the ticket so I don’t know what what said.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.