什麼是來源伺服器?| 來源伺服器定義

來源伺服器的目的是處理和回應來自網際網路用戶端的傳入網際網路請求。

學習目標

閱讀本文後,您將能夠:

  • Define an origin server
  • Differentiate an origin server from a CDN edge server
  • Explain the limits of CDN origin server protection

相關內容


想要繼續瞭解嗎?

收到最熱門網際網路深入解析的每月回顧!

請參閱 Cloudflare 的隱私權政策,了解我們如何收集和處理您的個人資料。

複製文章連結

什麼是來源伺服器?

原始伺服器的目的是處理和回應來自網際網路用戶端的傳入網際網路請求。原始伺服器的概念通常與邊緣伺服器快取伺服器的概念結合使用。原始伺服器的核心是運行一個或多個程式的電腦,這些程式旨在偵聽和處理傳入的網際網路請求。原始伺服器可以承擔為網際網路資產(如網站)提供內容的所有責任,前提是流量不超過伺服器能夠處理的範圍,且延遲不是主要問題。

The physical distance between an origin server and a client making a request adds latency to the connection, increasing the time it takes for an internet resource such as a webpage to be loaded. The additional round-trip time (RTT) between client and origin server required for a secure Internet connection using SSL/TLS also add additional latency to the request, directly impacting the experience of the client requesting data from the origin. By using a content delivery network (CDN) round-trip time is able to be reduced, and the amount of requests to an origin server are also able to be reduced.

原始伺服器和 CDN 邊緣伺服器有什麼區別?

簡而言之,CDN 邊緣伺服器是放置在全球主要網際網路提供者之間的重要節點的電腦,其作用是儘快交付內容。邊緣伺服器位於網路「邊緣」的 CDN 內,專門設計用於快速處理請求。透過將邊緣伺服器戰略性地放置在網路之間存在的網際網路交換點 (IXP) 內,CDN 能夠減少到達網際網路上特定位置所需的時間。

These edge servers cache content in order to take the load off of one or more origin servers. By moving static assets like images, HTML, and JavaScript files (and potentially other content) as close as possible to the requesting client machine, an edge server cache is able to reduce the amount of time it takes for a web resource to load. Origin servers still have an important function to play when using a CDN, as important server-side code such as the database of hashed client credentials used for authentication is typically maintained inside an origin server.

以下簡單範例說明了邊緣伺服器和原始伺服器如何協同工作以提供登入頁面並允許使用者登入到服務。非常簡單的登入頁面需要下載以下靜態資產才能正確呈現網頁:

  1. 網頁的 HTML 檔案
  2. 網頁樣式的 CSS 檔案
  3. 多個影像檔案
  4. 幾個 JavaScript 庫

這些檔案都是靜態檔案;它們不是動態產生的,對於網站的所有訪客都是相同的。因此,這些檔案既可以快取,也可以從邊緣伺服器提供給用戶端。所有這些檔案都可以在更靠近用戶端電腦的地方載入,且源站無需消耗任何頻寬。

CDN 邊緣快取回應

接下來,當使用者輸入其登入名稱和密碼並按下「登入」時,對動態內容的請求將傳輸回邊緣伺服器,然後邊緣伺服器將請求代理回原始伺服器。然後,源站在傳送回特定帳戶資訊之前驗證關聯資料庫表中的使用者身分。

CDN 未快取源站擷取圖

使用 CDN 時,處理靜態內容的邊緣伺服器與提供動態內容的原始伺服器各自承擔一些責任。某些 CDN 的功能也可能超出這一簡單的模型。

使用 CDN 時,原始伺服器還會受到攻擊嗎?

簡單來說,會。CDN 不會使原始伺服器立於不敗之地,但如果使用得當,它可以使原始伺服器不可見,充當傳入請求的盾牌。隱藏原始伺服器的真實 IP 位址是設定 CDN 的重要環節。因此,CDN 提供者應建議在實作 CDN 策略時變更原始伺服器的 IP 位址,以防止 DDoS 攻擊繞過盾牌並直接攻擊原始伺服器。Cloudflare 的 CDN 包括全面的 DDoS 防護。