Thanks for the response, I’ve resolved the issue.
The short version is when I purged the the whole cache in cloudfront, this worked.
The longer version:
Yes, the content-type had been set to application/octet-stream, then updated later. However the change wasn’t coming through.
The problem was that cloudfront was caching this also. It’s a bit messy, but cloudfront wasn’t really being used as a CDN. It’s more being used as a tool to rewrite URLs, using [email protected]
I believed Cloudfront was configured to not cache anything, but it looks like it was caching the responses. What was confusing is that it appears it’s returning a cached response only some of the time. When I make a direct request to cloudfront, it bypasses the cache. When calling it through cloudflare, it returned the cached version.
I had believed I’d purged the cache in Cloudfront, but it looks like I hadn’t caught the item I wanted to invalidate. When I cleared the full cache, this started working.