1
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?

【ざっくりとWeb技術の基本】Webページが表示される流れ(メモ)

Posted at

1. 基本的な考え方

リクエスト(Request)

クライアント(利用者側)が「こういう情報をください」「こういう処理をしてください」とサーバに送る要求。

レスポンス(Response)

サーバがその要求に対して返す答え。

例:

やり取りは必ず リクエスト → レスポンス という流れで進む。これを何度もやりとりする。他にもDBとやり取りし、データを取り出すこともある。

2. HTTP の場合

  • リクエストの例
GET /index.html HTTP/1.1
Host: example.com
User-Agent: Chrome/120

GET : リクエストの種類(メソッド)

/index.html : ほしいリソースの場所

Host: : サーバ名

User-Agent: : ブラウザ情報


  • レスポンスの例
HTTP/1.1 200 OK
Content-Type: text/html

<html> ... </html>

200 OK : ステータスコード(成功)

Content-Type : データの種類

よくあるステータスコード1

HTTPレスポンスには、「ステータスコード」がある。詳しく記載する。

ステータスコード 代表例 意味
成功レスポンス (200 – 299) 200 OK 正常に処理できた
リダイレクトメッセージ (300 – 399) 301/302 別の場所に移動(リダイレクト)
クライアントエラーレスポンス (400 – 499) 404 Not Found ページが存在しない
サーバーエラーレスポンス (500 – 599) 500 Internal Server Error サーバ側のエラー
  1. RFC 9110 で定義されている。

1
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
1
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?