spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

[Gateway MVC] ERR_HTTP2_PROTOCOL_ERROR if HTTP/2 enabled

Open benba opened this issue 1 year ago • 2 comments

if server.http2.enabled is set to true, using JDK HttpClient, and if the downstream server also exchange in HTTP/2, a HTTP/2 protocol error will be raised (ERR_HTTP2_PROTOCOL_ERROR in Chrome for example).

curl gives more details about the issue: PROTOCOL_ERROR Invalid HTTP header filed was received: frame type: 1, stream: 1, name: [:status], value: [200]

An easy workardound is to add a HttpHeadersFilter.ResponseHttpHeadersFilter that removes the :status pseudo-header.

I can submit a PR if you feel that it's an appropriate fix

benba avatar Mar 28 '24 15:03 benba

PRs welcome

spencergibb avatar Apr 05 '24 15:04 spencergibb

For anyone stumbling upon this and looking for a workaround, I replaced the JDK HttpClient by adding Apache httpclient (org.apache.httpcomponents.client5:httpclient5) dependency and adding spring.cloud.gateway.mvc.http-client.type: autodetect.

ebarliba avatar May 14 '24 12:05 ebarliba