Why did I have to disable HTTP/2 in AWS Applicatio

2019-08-12 02:37发布

问题:

When I deployed my web application to an AWS environment with an Application Load Balancer (ALB), some of my web service endpoints would not return any data and my Chrome browser would report this error for some http calls: ERR_SPDY_PROTOCOL_ERROR

Upon finding this recommendation, I disabled HTTP/2 support in my ALB configuration and everything works now.

Why did I have to disable HTTP/2 in my ALB? What is the root issue here? Do I need to change something in my web service code so that I can use HTTP/2?

UPDATE

Here are the response headers:

HTTP/1.1 200
Date: Wed, 09 Jan 2019 21:39:13 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Locations Reached: Data to populate locations reached map

As suggested by one of the answers below, the culprit is probably the fact that one of my headers (Locations Reached) has a space in the name, which is invalid/malformed. I'll make sure that space gets replaced by a dash.

回答1:

Usually means you have an invalid HTTP/2 header. HTTP/2 is more strict than HTTP/1.1 in this regard.

So HTTP header names with colons, spaces, new lines (e.g. opening quotes but forgetting to close the quotes in your config) and the like in the name are invalid (these can exist in the header values but not in the names).

See here for details on how to debug: https://www.michalspacek.com/chrome-err_spdy_protocol_error-and-an-invalid-http-header.

Add your HTTP/1.1 response headers to your question and might be able to point you in the right direction.