Na verdade, você é capaz de obter 200 OK
resposta HTTP, mas você não pode vê-la com head -1
.
A opção crucial é -L
:
-L, --location
(HTTP/HTTPS) If the server reports that the requested page has moved to a different location (indicated with a
Location
: header and a3XX
response code), this option will makecurl
redo the request on the new place. If used together with-i
,--include
or-I
,--head
, headers from all requested pages will be shown.
$ curl -LIs http://www.shellhacks.com
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 13 Mar 2018 12:58:31 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
Location: https://www.shellhacks.com/
X-Page-Speed: on
Cache-Control: max-age=0, no-cache
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 13 Mar 2018 12:58:31 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Link: <https://www.shellhacks.com/wp-json/>; rel="https://api.w.org/"
Set-Cookie: qtrans_front_language=en; expires=Wed, 13-Mar-2019 12:58:31 GMT; Max-Age=31536000; path=/
X-Page-Speed: on
Cache-Control: max-age=0, no-cache