qmatic / api-gateway

The Orchestra REST API gateway
MIT License
1 stars 0 forks source link

Content-Length header not set on health endpoint, making monitoring harder #15

Open kripe opened 4 years ago

kripe commented 4 years ago

Reported against version 1.4.8.0

When accessing the /api-gateway/health endpoint, the response does not contain a Content-Length header, which makes it impossible to configure a health-check endpoint in our loadbalancer.

This is seen when calling the endpoint using HTTP/1.1

curl -vv --http1.1 -H 'Accept-Encoding: gzip' -i http://localhost:9091/api-gateway/health
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9091 (#0)
> GET /api-gateway/health HTTP/1.1
> Host: localhost:9091
> User-Agent: curl/7.57.0
> Accept: */*
> Accept-Encoding: gzip
> 
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Connection: keep-alive
Connection: keep-alive
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Content-Type: application/json;charset=UTF-8
Content-Type: application/json;charset=UTF-8
< Date: Fri, 09 Oct 2020 14:12:57 GMT
Date: Fri, 09 Oct 2020 14:12:57 GMT

< 
* Connection #0 to host localhost left intact
{"status":"UP","diskSpace":{"status":"UP","total":822707298304,"free":194827571200,"threshold":10485760},"refreshScope":{"status":"UP"},"hystrix":{"status":"UP"}}

And this is seen using HTTP/1.0 (which doesn't support chunked encoding):

curl -vv --http1.0 -H 'Accept-Encoding: gzip' -i http://localhost:9091/api-gateway/health
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9091 (#0)
> GET /api-gateway/health HTTP/1.0
> Host: localhost:9091
> User-Agent: curl/7.57.0
> Accept: */*
> Accept-Encoding: gzip
> 
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
HTTP/1.0 200 OK
< Connection: close
Connection: close
< Content-Type: application/json;charset=UTF-8
Content-Type: application/json;charset=UTF-8
< Date: Fri, 09 Oct 2020 14:13:34 GMT
Date: Fri, 09 Oct 2020 14:13:34 GMT

< 
* Closing connection 0
{"status":"UP","diskSpace":{"status":"UP","total":822707298304,"free":194827489280,"threshold":10485760},"refreshScope":{"status":"UP"},"hystrix":{"status":"UP"}}

We'd like to have a Content-Length header in the response to satisfy our loadbalancer requirement.