IETF公佈了新的HTTP狀態碼-103, 總結一下就是提前預加載(css、js)文檔,提升用戶的訪問速度。
Summary: a new status code that lets the server send headers early, before the main headers. This helps with optimisations like preloading. Example from the document:
HTTP/1.1 103 Early Hints
Link: </main.css>; rel=preload; as=style
HTTP/1.1 103 Early Hints
Link: </style.css>; rel=preload; as=style
Link: </script.js>; rel=preload; as=script
HTTP/1.1 200 OK
Date: Fri, 26 May 2017 10:02:11 GMT
Content-Length: 1234
Content-Type: text/html; charset=utf-8
Link: </main.css>; rel=preload; as=style
Link: </newstyle.css>; rel=preload; as=style
Link: </script.js>; rel=preload; as=script
The client can start preloading the CSS and JavaScript before the main headers arrive. This is a nice optimisation.
There are various security risks with sending multiple headers to non-conforming clients hence: “Therefore, a server might refrain from sending Early Hints over HTTP/1.1 unless the client is known to handle informational responses correctly.”
在頭部信息到達之前,用戶可以開始預加載CSS和JavaScript文件,這是一個很好的優化。
因此,向不合格的客戶機發送多個標頭存在各種各樣的安全風險:“因此,如果客戶不知道正確處理信息響應,服務器可能會避免發送HTTP / 1.1的早期提示。”