I need the content-length header because I want to show the user a progress bar as they are downloading a resource (I use XMLHttpRequest).
I noticed that Cloudflare doesn’t specify the content-length only when requesting compressed content.
Requesting plain content:
> curl 'https://bombhopper.io/bundle.js' -I
HTTP/2 200
date: Fri, 06 Dec 2019 12:55:40 GMT
content-type: application/javascript
content-length: 1055924
set-cookie: __cfduid=dbc2e3e013a14713c921f17105b07c25a1575636939; expires=Sun, 05-Jan-20 12:55:39 GMT; path=/; domain=.bombhopper.io; HttpOnly; Secure
x-amz-id-2: MX4p6ULHOWqovXSXXV92LBLKEKTRASIM8bdKXNKGIvh1tz6Q3d1fBRkXkoNGtaESz55jUi7Zi1E=
x-amz-request-id: 42456EC52F9D49A5
cache-control: max-age=0,must-revalidate,public
last-modified: Fri, 06 Dec 2019 01:17:02 GMT
etag: "4dd36d675beda068685226b5b563e05c"
cf-cache-status: REVALIDATED
accept-ranges: bytes
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
alt-svc: h3-23=":443"; ma=86400
server: cloudflare
cf-ray: 540e6a5aafc0edf7-CDG
Requesting compressed content:
> curl 'https://bombhopper.io/bundle.js' -H 'accept-encoding: gzip' -I
HTTP/2 200
date: Fri, 06 Dec 2019 13:07:35 GMT
content-type: application/javascript
set-cookie: __cfduid=de672103e315b9d5eafcba71a3b5aaedc1575637655; expires=Sun, 05-Jan-20 13:07:35 GMT; path=/; domain=.bombhopper.io; HttpOnly; Secure
x-amz-id-2: MX4p6ULHOWqovXSXXV92LBLKEKTRASIM8bdKXNKGIvh1tz6Q3d1fBRkXkoNGtaESz55jUi7Zi1E=
x-amz-request-id: 42456EC52F9D49A5
cache-control: max-age=0,must-revalidate,public
last-modified: Fri, 06 Dec 2019 01:17:02 GMT
etag: W/"4dd36d675beda068685226b5b563e05c"
cf-cache-status: REVALIDATED
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
vary: Accept-Encoding
alt-svc: h3-23=":443"; ma=86400
server: cloudflare
cf-ray: 540e7bd15cc6ee33-CDG
content-encoding: gzip
I get this for Brotli compression too. I have Cache Level set to Cache everything, nothing too special in my settings otherwise.