Cloudflare doesn't return all headers in cached response

What is the name of the domain?

What is the issue you’re encountering

Cloudflare doesn’t return all headers in cached response

What are the steps to reproduce the issue?

I’m trying to enable caching on a route to cache an RSS feed (text/xml). I added a rule in Cloudflare to allow text/xml to be cached (By default it is not cached). I was surprised to see that this affected the headers that Cloudflare responded with.

The uncached response looks like this:

HTTP/2 200
date: Tue, 25 Feb 2025 22:17:06 GMT
content-type: text/xml; charset=utf-8
vary: Accept-Encoding
cache-control: public, max-age=301, stale-while-revalidate=3601, stale-if-error=3601
last-modified: Wed, 05 Feb 2025 18:37:14 UTC
x-app-test: testing
x-content-type-options: nosniff
strict-transport-security: max-age=31536000; includeSubDomains; preload
permissions-policy: interest-cohort=()
referrer-policy: origin-when-cross-origin
cross-origin-opener-policy: same-origin
cf-cache-status: DYNAMIC
server: cloudflare
cf-ray: 917b10434c7950ae-AKL

The cached response looks like this

HTTP/2 200
date: Tue, 25 Feb 2025 22:18:58 GMT
content-type: text/xml; charset=utf-8
vary: Accept-Encoding
x-content-type-options: nosniff
strict-transport-security: max-age=31536000; includeSubDomains; preload
permissions-policy: interest-cohort=()
referrer-policy: origin-when-cross-origin
cross-origin-opener-policy: same-origin
cf-cache-status: HIT
age: 4001
last-modified: Tue, 25 Feb 2025 21:12:17 GMT
server: cloudflare
cf-ray: 917b130089b51c5f-AKL

Note that some of the headers are missing or modified in the cached response:

Before:

cf-cache-status: DYNAMIC
cache-control: public, max-age=301, stale-while-revalidate=3601, stale-if-error=3601
last-modified: Wed, 05 Feb 2025 18:37:14 UTC
x-app-test: testing

After:

cf-cache-status: HIT
age: 4001
last-modified: Tue, 25 Feb 2025 21:12:17 GMT

I would expect that Cloudflare would cache and return all headers as they are sent by the origin. Is there some way to do this?