0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

HTTPヘッダから誰が応答しているかを確認する。

Posted at

概要

Webページのアクセス先の内容を確認するために、ヘッダを確認したいという事がある。
その時は、curlコマンドで確認してみよう。

実行コマンド

curl -I urlまたはfqdn
実行結果
HTTP/1.1 404 Not Found
Date: Sat, 09 Sep 2023 14:37:06 GMT
Server: WSGIServer/0.2 CPython/3.11.0
Content-Type: text/html; charset=utf-8
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin
Cross-Origin-Opener-Policy: same-origin
Set-Cookie: xascszzzzzzzzzzzzzzz

そして、ここでいうServerの欄が、返答している者である。

サーバによっては、nginxだったりが返答している事もある。

[user@server~]$ curl -Ik https://略
HTTP/1.1 200 OK
Server: nginx/1.22.1
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/8.1.2
Cache-Control: no-cache, private
略

リダイレクトになっているかは、Locationで確認できる。
以下のように、Locationがhttpsでそのままつけられて表示されているときは、

  • httpsをつけて実行
  • もしくはcurl -L
    でリダイレクト先を確認できる。
リダイレクト先が表示されえない
[user@server~]$ curl -Ik https://sample~~
HTTP/1.0 302 Moved Temporarity
Location: https://sample~~
Server: BIGIP
Connection: keep-alive
Content-Length: 0
curl -I https://~~~
もしくは
curl -IL htttp://~~

実行結果

[user@server~]$ curl -Ik https://略
HTTP/1.1 200 OK
Server: nginx/1.22.1
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/8.1.2
Cache-Control: no-cache, private
略
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?