We are running our test suite agains our Cloudflare domain and for some reason we are receiving sometimes the request id header as x-request-id instead of the one returned by our origin server that is X-Request-Id (notice the differences in lowercase letters).
We have re-checked everything and our server is returning without any doubt X-Request-Id.
Any reason why Cloudflare could be modifying/altering this header only sometimes for the same URL?
I haven’t heard of this before. If you look at all the headers, might there be some clue as to what’s different? Do you also see the Cloudflare IP address that’s making the request? (not the visitor’s forwarded IP in the header…I’m just looking for clues as to which Cloudflare node it’s coming through)
Reply to the ticket and say the headers are still inconsistent and include a link to this thread (if you didn’t already do that). That should re-open it.
Meanwhile, I’ll push this into the escalation queue.
I already escalated, but for fun, you can reply again and say you need more help. I’d be curious to hear how many replies it takes for it to not slam the ticket closed on you.
…sometimes. But why the inconsistent behavior? I was hoping to find a feature that would “normalize” headers, but can’t find anything except for Workers, which is overkill.
Take a look to my previous comments, it’s happening to me with HTTP/1.1 request.
Not exactly, we have a complete suite of tests that checks a lot of things for our application, one of those things is to check that expected headers are included in the response and those checks are done in a case-sensitive way so our test suite is failing for that reason.
We know that headers are case-insensitive in the HTTP specification but I would like to understand the reason behind this inconsistency.
We have other cases were headers dissapear completely, for example we are responding with Vary headers in some scenarios and those appear only sometimes in the Cloudflare response.
With HTTP/1.1 it is not a requirement that HTTP responses headers be lowercase where it is in HTTP/2. I’d suggest only using http/2 requests if this consistency is needed in your application, or dropping the requirement if possible.
Just as in HTTP/1.x, header field names are strings of ASCII characters that are compared in a case-insensitive fashion. However, header field names MUST be converted to lowercase prior to their encoding in HTTP/2. A request or response containing uppercase header field names MUST be treated as malformed (Section 8.1.2.6).