Closed tmack8001 closed 7 years ago
Obviously headers.add(new Pair<>("Content-Length", "" + 612));
isn't what I want to have here, this was just a quick hack to see if things were going to "work" if that header was present... and it did do the job successfully.
UPDATE: to get the actual response size added in the header I changed the above to
headers.add(new Pair<>("Content-Length", "" + context.getOriginContentLength()));
Is this a problem with Spring Cloud or Zuul? From your description it seems the problem is with Zuul and not anything in the Spring Cloud library.
At the moment I'm not actually sure. In my debugging yesterday wasn't able to find where the "Connection: Closed" was coming from nor why a HTTP/1.0 request was being marked for chunked encoding.
You are right after launching the zuul (vanilla) with eureka and a sample hello app I still see this type of thing. So will open a ticket over with netflix/zuul
In testing things today I noticed that when a client is using http/1.0 and attempting to use keep-alive Zuul (setup with spring-cloud-netflix) returns a "Connection: closed" header. I'm have a filter similar to the NFPostDecoration filter (https://github.com/Netflix/zuul/blob/939ada9dce57709cf6b250b77fabfa37e8d988bf/zuul-netflix-webapp/src/main/groovy/filters/post/PostDecoration.groovy#L61) that is attempting to force keep-alive from the zuul server side. The forcing of keep-alive works for http/1.1 clients, but has a bug in http/1.0 where there are two "Connection" headers (close, and keep-alive) as well
Here is a way to reproduce this using curl, found the issues when attempting a benchmark using AB (ApacheBench/2.3).
Here is how I have modified my Filter to "force" AB to be happy with the response and it also seems to allow keep-alive on Http/1.0 which requires a Content-Length header and further more Http/1.0 doesn't support chunked encoding.
After adding this caused AB did a benchmark successfully making 99% keep-alive requests and also makes it so that there is only one Connection header being returned by Zuul (the keep alive one I'm attempting to force).