Error HTTP/2 stream 0 was not closed cleanly:

Hello all,

I setup tyk successfully with loadbalancing with Consul. But from one of the API microservice I get the below error when used with CURL
curl: (92) HTTP/2 stream 0 was not closed cleanly: INTERNAL_ERROR (err 2)
When I use POSTMAN, I get the below error
Error: Stream error in the HTTP/2 framing layer

Now if I call the API directly, I get proper response. I think the error has something to do with http versions. Can anyone help ?
Thank you!

When you say you call the API directly does the request go through Consul?

Can you share the result for the following?

  • curl to Consul to Tyk to your API
  • curl to Consul to your API
  • curl to Tyk to your API

My request flow is like :

                             Consul
                                ^
                                |
  Request --> public nginx --> tyk --> microservice(spring boot)

When I do curl to the microservice directly (docker container) I get the proper response.

I am thinking more of some http version mismatch between Tyk and my SpringBoot microservice.
How do I configure http versions in Tyk ?

I see. But what I am trying to get at is if you remove Consul out of the equation does that do anything?

@tocn - could you check value of "enable_http2": true in the tyk.conf or env var TYK_GW_HTTPSERVEROPTIONS_ENABLEHTTP2=true?

Screenshot 2021-05-04 at 18.45.48

1 Like

@zaid
I will remove consul and post here if it changes anything.
Here is my consul config in apps directory for reference.

    "service_discovery": {
      "use_discovery_service": true,
      "use_target_list":true,
      "query_endpoint": "http://192.168.34.150:8505/v1/catalog/service/micro-service",
      "use_nested_query": false,
      "endpoint_returns_list":true,
      "data_path":"ServiceAddress",
      "port_data_path":"ServicePort"
    }
1 Like

@ahmet I do not have that http2 config in my tyk.conf,. Just to show you my current curl responses for Nginx, Tyk and my microservice. All are HTTP/1.1, but I will make that config change in tyk and get back soon. Thanks!

My Tyk reponse for head is this:

curl --head http://192.168.34.150:5555/hello
HTTP/1.1 200 OK
Date: Tue, 04 May 2021 17:56:29 GMT
Content-Length: 10
Content-Type: text/plain; charset=utf-8
Connection: close

My public Nginx response for head is this.

curl --head https://dev.xxxxxxxx.com
HTTP/1.1 200
Server: nginx/1.10.3 (Ubuntu)
Date: Tue, 04 May 2021 17:54:07 GMT
Content-Type: text/html
Content-Length: 3318
Connection: keep-alive
Set-Cookie: JSESSIONID=4EB00D4B21FE38A55544C0BBF6590F1C; Path=/; HttpOnly
Last-Modified: Fri, 30 Apr 2021 20:38:21 GMT
Accept-Ranges: bytes
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS, HEAD
Access-Control-Allow-Headers: Authorization, Origin, X-Requested-With, Content-Type, Accept, api_key

Response from the microservice is this:

curl --head http://192.168.34.150:7777/actuator/health
HTTP/1.1 200
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: SAMEORIGIN
Content-Type: application/vnd.spring-boot.actuator.v2+json;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 04 May 2021 18:00:09 GMT