You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
curlto limit the response.Example with --head
Example without --head
When calling the GET endpoint with the HEAD method should just return the HTTP header and a 200.