Skip to content
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.

HealthCheck endpoint does not support HTTP Method HEAD #29

Open
kris-evans opened this issue Jan 17, 2020 · 0 comments
Open

HealthCheck endpoint does not support HTTP Method HEAD #29

kris-evans opened this issue Jan 17, 2020 · 0 comments

Comments

@kris-evans
Copy link

kris-evans commented Jan 17, 2020

I was attempting to curl a healthcheck endpoint as part of a wait-for-it script in Docker and noticed an issue with the HealthCheck server. The server, by default, doesn't respond to the HTTP Method HEAD which is often used with curl to limit the response.

Example with --head

# curl -v --head http://api:8071/_ready
*   Trying 172.22.0.8...
* TCP_NODELAY set
* Connected to api (172.22.0.8) port 8071 (#0)
> HEAD /_ready HTTP/1.1
> Host: api:8071
> User-Agent: curl/7.52.1
> Accept: */*
> 
< HTTP/1.1 405 Method Not Allowed
HTTP/1.1 405 Method Not Allowed
< Content-Type: text/plain; charset=utf-8
Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
X-Content-Type-Options: nosniff
< Date: Fri, 17 Jan 2020 19:55:24 GMT
Date: Fri, 17 Jan 2020 19:55:24 GMT
< Content-Length: 19
Content-Length: 19

< 
* Curl_http_done: called premature == 0
* Connection #0 to host api left intact

Example without --head

# curl -v http://api:8071/_ready
*   Trying 172.22.0.8...
* TCP_NODELAY set
* Connected to api (172.22.0.8) port 8071 (#0)
> GET /_ready HTTP/1.1
> Host: api:8071
> User-Agent: curl/7.52.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Date: Fri, 17 Jan 2020 19:55:32 GMT
< Content-Length: 3
< 
{}
* Curl_http_done: called premature == 0
* Connection #0 to host api left intact

When calling the GET endpoint with the HEAD method should just return the HTTP header and a 200.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant