---
title: HTTP
slug: Web/HTTP
tags:
  - HTTP
  - NeedsTranslation
translation_of: Web/HTTP
---
{{HTTPSidebar}}
超文本傳輸協定 (HTTP) 是一種用來傳輸超媒體文件 (像是HTML文件) 的應用層協定,被設計來讓瀏覽器和伺服器進行溝通,但也可做其他用途。HTTP 遵循標準客戶端—伺服器模式,由客戶端連線以發送請求,然後等待接收回應。HTTP 是一種無狀態協定,意思是伺服器不會保存任兩個請求間的任何資料 (狀態)。儘管作為 TCP/IP 的應用層,HTTP 亦可應用於其他可靠的傳輸層 (例如 UDP),只要不會無聲無息地遺失訊息即可。
教學
學習如何使用HTTP的指南和教程。
 - HTTP的概觀
 
 - 基本特性:它能做什麼與它的用途
 
 - HTTP Cache
 
 - Cache對網站速度很重要。  此文章描敘不同的方法使用HTTP Header控制它。
 
 - HTTP Cookies
 
 - RFC 6265 定義了cookies的工作方式,當HTTP請求一個服務時,一個伺服器可以發送一個
Set-Cookie的HTTP header回應。客戶端將以header的方式回傳cookie值給每個請求的同 一個伺服器,Cookie也會在某些時間進行更新,或是限制一個實體網域或路徑。 
 - HTTP Access Control (CORS)
 
 - Cross-site HTTP requests 是來自不同網域的資源請求。舉個例子,一個HTML網頁從網域A (
http://domaina.example/) 從網域B(http://domainb.foo/image.jpg)請求一個圖片,經由img元件。現今的網頁通常會讀取跨站資源,包括CSS樣式表、圖片、腳本與其他資源。CORS允許網頁開發人員的網站響應跨站讀取。 
 - HTTP的演化
 
 - HTTP早期版本變化的簡要說明,到現在的HTTP/2與其他版本。
 
 - 網頁安全方針
 
 - 一些技巧幫助運作團隊開發安全的網頁。
 
 - HTTP 訊息
 
 - 描述HTTP/1與HTTP/2不同類別與結構。
 
 - 一個典型HTTP對話
 
 - 顯示並解釋HTTP的通常對話流程。
 
 - HTTP/1.x的連接管理
 
 - 描述在HTTP/1.x中可用的三種連接管理。
 
 
參考
詳細的HTTP參考文件。
 - HTTP Headers
 
 - HTTP message headers are used to describe a resource, or the behavior of the server or the client. Custom proprietary headers can be added using the 
X- prefix; others in an IANA registry, whose original content was defined in RFC 4229. IANA also maintains a registry of proposed new HTTP message headers. 
 - HTTP 請求方法
 
 - 透過 HTTP 有幾種不同操作方法:{{HTTPMethod("GET")}}, {{HTTPMethod("POST")}}, and also less common requests like {{HTTPMethod("OPTIONS")}}, {{HTTPMethod("DELETE")}}, or {{HTTPMethod("TRACE")}}.
 
 - HTTP 狀態回應碼
 
 - HTTP response codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes: informational responses, successful responses, redirections, client errors, and servers errors.
 
 - CSP directives
 
 - The {{HTTPHeader("Content-Security-Policy")}} response header fields allows web site administrators to control resources the user agent is allowed to load for a given page. With a few exceptions, policies mostly involve specifying server origins and script endpoints.
 
工具與資源
Helpful tools and resources for understanding and debugging HTTP.
 - Firefox Developer Tools
 
 - Network monitor
 
 - Mozilla Observatory
 
 - 
 
A project designed to help developers, system administrators, and security professionals configure their sites safely and securely.
  
 - RedBot
 
 - Tools to check your cache-related headers
 
 - How Browsers Work
 
 - A very comprehensive article on browser internals and request flow through HTTP protocol. A MUST-READ for any web developer.