304 reponse headers

Hello,

I have a Compute service whose origin always returns an X-Request-ID header. When the fetch returns a 200 and it’s a HIT in the cache, the response includes this header. However, when the fetch returns a 304 and it’s also a HIT, the response doesn’t include the header. Why does this happen?

Thanks!

1 Like

Hi @Angel that’s because a 304 response by default doesn’t transmit anything other than the fact that the origin content hasn’t changed. It’s intended to tell the client that the previous information (including the X-Request-ID header) is unchanged from the initial response received.

Is generating a new X-Request-ID header something you need, or are you asking about he reason for this specific behavior?

Hi @aspires, no, I don’t need it. I just wanted to know.

Thanks for your response.

1 Like