HTTP/2 response header field not in Pascal Case in Google Chrome

I am hitting the same URL (can't disclose the URL due to customer confidentiality) on Google Chrome Version 55.0.2883.95 (64-bit) and Version Mozilla 50.1.0, but the response header fields on browsers Google Chrome and Mozilla are different.

The response on Google Chrome is : -

HTTP/2 200 access-control-allow-origin: * content-encoding: gzip content-type: application/json;charset=UTF-8

The header fields are not in Pascal Case, but the response on Mozilla is : -

HTTP/2 200 Access-Control-Allow-Origin: * Content-Encoding: gzip Content-Type: application/json;charset=UTF-8

The header fields are in Pascal case.

Now I know that are per article RFC2616 section 4.2 (https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html - sec4.2), which says

“Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive.

But my customer runs some custom caching Library on his application which starts complaining if the Content-Encoding header is not in Pascal case.

Any idea on what could be a possible fix? Thanks in advance :)


The HTTP/2 specification is clear about the fact that headers must be converted to lower-case prior encoding.

Over the wire, both browsers receive response headers in lower-case, as per HTTP/2 specification.

It looks like Chrome passes the header names as-is to the application layer, while Firefox makes an attempt to restore the Pascal case, at least for known header names.

You can file an issue to either browser, but I doubt it will be addressed.

The real problem is the broken caching library of your customer, that should have taken into consideration the fact that HTTP header names are case insensitive from the beginning.

What you can do, depending on the technology you are using, is to write an adapter layer that does the Pascal case conversion of header names before accessing the broken caching library.

链接地址: http://www.djcxy.com/p/71834.html

上一篇: 抛出HttpException总是发回HTTP 500错误?

下一篇: HTTP / 2响应标题字段不在Google Chrome中的Pascal案例中