{"id":83243,"date":"2023-11-18T10:56:11","date_gmt":"2023-11-18T02:56:11","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=83243"},"modified":"2023-11-18T10:56:11","modified_gmt":"2023-11-18T02:56:11","slug":"http-https-hsts","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/http-https-hsts.html","title":{"rendered":"HTTP \u5230 HTTPS \u518d\u5230 HSTS \u7684\u8f6c\u53d8"},"content":{"rendered":"
\u8fd1\u4e9b\u5e74\uff0c\u968f\u7740\u57df\u540d\u52ab\u6301\u3001\u4fe1\u606f\u6cc4\u6f0f\u7b49\u7f51\u7edc\u5b89\u5168\u4e8b\u4ef6\u7684\u9891\u7e41\u53d1\u751f\uff0c\u7f51\u7ad9\u5b89\u5168\u4e5f\u53d8\u5f97\u8d8a\u6765\u8d8a\u91cd\u8981\uff0c\u4e5f\u4fc3\u6210\u4e86\u7f51\u7edc\u4f20\u8f93\u534f\u8bae\u4ece HTTP \u5230 HTTPS \u518d\u5230 HSTS \u7684\u8f6c\u53d8\u3002<\/p>\n
HTTP\uff08\u8d85\u6587\u672c\u4f20\u8f93\u534f\u8bae\uff09 \u662f\u4e00\u79cd\u7528\u4e8e\u5206\u5e03\u5f0f\u3001\u534f\u4f5c\u5f0f\u548c\u8d85\u5a92\u4f53\u4fe1\u606f\u7cfb\u7edf\u7684\u5e94\u7528\u5c42\u534f\u8bae\u3002HTTP \u662f\u4e92\u8054\u7f51\u6570\u636e\u901a\u4fe1\u7684\u57fa\u7840\u3002\u5b83\u662f\u7531\u4e07\u7ef4\u7f51\u534f\u4f1a\uff08W3C\uff09\u548c\u4e92\u8054\u7f51\u5de5\u7a0b\u4efb\u52a1\u7ec4\uff08IETF\uff09\u8fdb\u884c\u534f\u8c03\u5236\u5b9a\u4e86 HTTP \u7684\u6807\u51c6\uff0c\u6700\u7ec8\u53d1\u5e03\u4e86\u4e00\u7cfb\u5217\u7684 RFC\uff0c\u5e76\u4e14\u57281999\u5e746\u6708\u516c\u5e03\u7684 RFC 2616\uff0c\u5b9a\u4e49\u4e86 HTTP \u534f\u8bae\u4e2d\u73b0\u4eca\u5e7f\u6cdb\u4f7f\u7528\u7684\u4e00\u4e2a\u7248\u672c\u2014\u2014HTTP 1.1\u3002<\/p>\n
HTTP \u5c5e\u4e8e TCP\/IP \u6a21\u578b\u4e2d\u7684\u5e94\u7528\u5c42\u534f\u8bae\uff0c\u5f53\u6d4f\u89c8\u5668\u4e0e\u670d\u52a1\u5668\u8fdb\u884c\u4e92\u76f8\u901a\u4fe1\u65f6\uff0c\u9700\u8981\u5148\u5efa\u7acbTCP \u8fde\u63a5\uff0c\u4e4b\u540e\u670d\u52a1\u5668\u624d\u4f1a\u63a5\u6536\u6d4f\u89c8\u5668\u7684\u8bf7\u6c42\u4fe1\u606f\uff0c\u5f53\u63a5\u6536\u5230\u4fe1\u606f\u4e4b\u540e\uff0c\u670d\u52a1\u5668\u8fd4\u56de\u76f8\u5e94\u7684\u4fe1\u606f\u3002\u6700\u540e\u6d4f\u89c8\u5668\u63a5\u53d7\u5bf9\u670d\u52a1\u5668\u7684\u4fe1\u606f\u5e94\u7b54\u540e\uff0c\u5bf9\u8fd9\u4e9b\u6570\u636e\u8fdb\u884c\u89e3\u91ca\u6267\u884c\u3002
\n<\/p>\n
http 1.0 \u8bf7\u6c42\u6a21\u5f0f<\/em><\/p>\n HTTP 1.0 \u65f6\uff0c\u6d4f\u89c8\u5668\u6bcf\u6b21\u8bbf\u95ee\u90fd\u8981\u5355\u72ec\u5efa\u7acb\u8fde\u63a5\uff0c\u8fd9\u4f1a\u9020\u6210\u8d44\u6e90\u7684\u6d6a\u8d39\u3002<\/p>\n \u540e\u6765HTTP 1.1\u53ef\u4ee5\u5728\u4e00\u6b21\u8fde\u63a5\u4e2d\u5904\u7406\u591a\u4e2a\u8bf7\u6c42\uff0c\u5e76\u4e14\u5c06\u591a\u4e2a\u8bf7\u6c42\u91cd\u53e0\u8fdb\u884c\uff1a http 1.1 \u8bf7\u6c42\u6a21\u5f0f<\/em><\/p>\n HTTP \u534f\u8bae\u7531\u4e8e\u5176\u7b80\u5355\u5feb\u901f\u3001\u5360\u7528\u8d44\u6e90\u5c11\uff0c\u4e00\u76f4\u88ab\u7528\u4e8e\u7f51\u7ad9\u670d\u52a1\u5668\u548c\u6d4f\u89c8\u5668\u4e4b\u95f4\u8fdb\u884c\u6570\u636e\u4f20\u8f93\u3002\u4f46\u662f\u5728\u6570\u636e\u4f20\u8f93\u7684\u8fc7\u7a0b\u4e2d\u4e5f\u5b58\u5728\u5f88\u660e\u663e\u7684\u95ee\u9898\uff0c\u7531\u4e8e HTTP \u662f\u660e\u6587\u534f\u8bae\uff0c\u4e0d\u4f1a\u5bf9\u6570\u636e\u8fdb\u884c\u4efb\u4f55\u65b9\u5f0f\u7684\u52a0\u5bc6\u3002\u5f53\u9ed1\u5ba2\u653b\u51fb\u7a83\u53d6\u4e86\u7f51\u7ad9\u670d\u52a1\u5668\u548c\u6d4f\u89c8\u5668\u4e4b\u95f4\u7684\u4f20\u8f93\u62a5\u6587\u7684\u65f6\uff0c\u53ef\u4ee5\u76f4\u63a5\u8bfb\u53d6\u4f20\u8f93\u7684\u4fe1\u606f\uff0c\u9020\u6210\u7f51\u7ad9\u3001\u7528\u6237\u8d44\u6599\u7684\u6cc4\u5bc6\u3002\u56e0\u6b64 HTTP \u4e0d\u9002\u7528\u4e8e\u654f\u611f\u4fe1\u606f\u7684\u4f20\u64ad\uff0c\u8fd9\u4e2a\u65f6\u5019\u9700\u8981\u5f15\u5165 HTTPS\uff08\u8d85\u6587\u672c\u4f20\u8f93\u5b89\u5168\u534f\u8bae\uff09\u3002<\/p>\n HTTPS\uff08Hypertext Transfer Protocol Secure \uff09\u662f\u4e00\u79cd\u4ee5\u8ba1\u7b97\u673a\u7f51\u7edc\u5b89\u5168\u901a\u4fe1\u4e3a\u76ee\u7684\u7684\u4f20\u8f93\u534f\u8bae\u3002\u5728HTTP\u4e0b\u52a0\u5165\u4e86SSL\u5c42\uff0c\u4ece\u800c\u5177\u6709\u4e86\u4fdd\u62a4\u4ea4\u6362\u6570\u636e\u9690\u79c1\u548c\u5b8c\u6574\u6027\u548c\u63d0\u4f9b\u5bf9\u7f51\u7ad9\u670d\u52a1\u5668\u8eab\u4efd\u8ba4\u8bc1\u7684\u529f\u80fd\uff0c\u7b80\u5355\u6765\u8bf4\u5b83\u5c31\u662f\u5b89\u5168\u7248\u7684 HTTP \u3002 HTTPS \u5728\u8fdb\u884c\u6570\u636e\u4f20\u8f93\u4e4b\u524d\u4f1a\u4e0e\u7f51\u7ad9\u670d\u52a1\u5668\u548cWeb\u6d4f\u89c8\u5668\u8fdb\u884c\u4e00\u6b21\u63e1\u624b\uff0c\u5728\u63e1\u624b\u65f6\u786e\u5b9a\u53cc\u65b9\u7684\u52a0\u5bc6\u5bc6\u7801\u4fe1\u606f\u3002<\/p>\n \u5177\u4f53\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n \u4e3a\u4e86\u4fdd\u62a4\u6570\u636e\u7684\u5b89\u5168\uff0cHTTPS \u8fd0\u7528\u4e86\u8bf8\u591a\u52a0\u5bc6\u7b97\u6cd5\uff1a<\/p>\n \u4f46\u662f\u5f53\u7f51\u7ad9\u4f20\u8f93\u534f\u8bae\u4ece HTTP \u5230 HTTPS \u4e4b\u540e\uff0c\u6570\u636e\u4f20\u8f93\u771f\u7684\u5b89\u5168\u4e86\u5417\uff1f<\/p>\n \u7531\u4e8e\u7528\u6237\u4e60\u60ef\uff0c\u901a\u5e38\u51c6\u5907\u8bbf\u95ee\u67d0\u4e2a\u7f51\u7ad9\u65f6\uff0c\u5728\u6d4f\u89c8\u5668\u4e2d\u53ea\u4f1a\u8f93\u5165\u4e00\u4e2a\u57df\u540d\uff0c\u800c\u4e0d\u4f1a\u5728\u57df\u540d\u524d\u9762\u52a0\u4e0a http:\/\/ \u6216\u8005 https:\/\/\uff0c\u800c\u662f\u7531\u6d4f\u89c8\u5668\u81ea\u52a8\u586b\u5145\uff0c\u5f53\u524d\u6240\u6709\u6d4f\u89c8\u5668\u9ed8\u8ba4\u586b\u5145\u7684\u90fd\u662fhttp:\/\/\u3002\u4e00\u822c\u60c5\u51b5\u7f51\u7ad9\u7ba1\u7406\u5458\u4f1a\u91c7\u7528\u4e86 301\/302 \u8df3\u8f6c\u7684\u65b9\u5f0f\u7531 HTTP \u8df3\u8f6c\u5230 HTTPS\uff0c\u4f46\u662f\u8fd9\u4e2a\u8fc7\u7a0b\u603b\u4f7f\u7528\u5230 HTTP \u56e0\u6b64\u5bb9\u6613\u53d1\u751f\u52ab\u6301\uff0c\u53d7\u5230\u7b2c\u4e09\u65b9\u7684\u653b\u51fb\u3002<\/p>\n \u8fd9\u4e2a\u65f6\u5019\u5c31\u9700\u8981\u7528\u5230 HSTS\uff08HTTP \u4e25\u683c\u5b89\u5168\u4f20\u8f93\uff09\u3002 HSTS\u662f\u56fd\u9645\u4e92\u8054\u7f51\u5de5\u7a0b\u7ec4\u7ec7 IETF \u6b63\u5728\u63a8\u884c\u4e00\u79cd\u65b0\u7684 Web \u5b89\u5168\u534f\u8bae\uff0c\u7f51\u7ad9\u91c7\u7528 HSTS \u540e\uff0c\u7528\u6237\u8bbf\u95ee\u65f6\u65e0\u9700\u624b\u52a8\u5728\u5730\u5740\u680f\u4e2d\u8f93\u5165 HTTPS\uff0c\u6d4f\u89c8\u5668\u4f1a\u81ea\u52a8\u91c7\u7528 HTTPS \u8bbf\u95ee\u7f51\u7ad9\u5730\u5740\uff0c\u4ece\u800c\u4fdd\u8bc1\u7528\u6237\u59cb\u7ec8\u8bbf\u95ee\u5230\u7f51\u7ad9\u7684\u52a0\u5bc6\u94fe\u63a5\uff0c\u4fdd\u62a4\u6570\u636e\u4f20\u8f93\u5b89\u5168\u3002<\/p>\n HSTS \u4e3b\u8981\u662f\u901a\u8fc7\u670d\u52a1\u5668\u53d1\u9001\u54cd\u5e94\u5934\u7684\u65b9\u5f0f\u6765\u63a7\u5236\u6d4f\u89c8\u5668\u64cd\u4f5c\uff1a<\/p>\n \u5f00\u542f HSTS \u540e\u7f51\u7ad9\u53ef\u4ee5\u6709\u6548\u9632\u8303\u4e2d\u95f4\u4eba\u7684\u653b\u51fb\uff0c\u540c\u65f6\u4e5f\u4f1a\u7701\u53bb\u7f51\u7ad9 301\/302 \u8df3\u8f6c\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u5927\u5927\u63d0\u5347\u5b89\u5168\u7cfb\u6570\u548c\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n \u5f00\u542f HSTS \u4ee5\u540e\uff0c\u53ef\u4ee5\u5230 ssllabs \u8fdb\u884c\u6d4b\u8bd5\uff0c\u7f51\u7ad9\u7684\u5b89\u5168\u7b49\u7ea7\u4f1a\u8fdb\u4e00\u6b65\u63d0\u5347\u3002<\/p>\n \u5f00\u542f\u524d\u7b49\u7ea7\u4e3a\uff1aA \u4ece HTTP \u5230 HTTPS \u518d\u5230 HSTS\uff0c\u7f51\u7ad9\u7684\u5b89\u5168\u7cfb\u6570\u4e00\u76f4\u5728\u4e0a\u5347\uff0c\u9632\u6b62 DNS \u52ab\u6301\u3001\u6570\u636e\u6cc4\u5bc6\u7684\u529b\u5ea6\u4e5f\u518d\u52a0\u5927\u3002\u56fd\u5185\u516c\u6709\u4e91\u670d\u52a1\u5546\u6bd4\u5982\u53c8\u62cd\u4e91\u63d0\u4f9b\u4e86\u5b8c\u6574\u7684 HTTPS\u548cHSTS\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u4e0d\u4ec5\u652f\u6301 SSL \u8bc1\u4e66\u5feb\u901f\u7533\u8bf7\uff0cHTTPS \u4e00\u952e\u90e8\u7f72\uff0c\u8fd8\u652f\u6301\u4e00\u952e\u5f00\u542f HSTS\uff0c\u611f\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u524d\u5f80\u53c8\u62cd\u4e91\u5b98\u7f51\u4e86\u89e3\u3002<\/p>\n \u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-8856-1.html<\/a><\/p>\n
\n<\/p>\n\n
\n
\nHTTP\u3001HTTPS \u5dee\u5f02<\/em><\/p>\n\n
\n<\/li>\n
\nHTTPS \u63e1\u624b\u8fc7\u7a0b<\/em><\/li>\n<\/ol>\n\n
\n\u4f8b\u5982\uff1aDES\u3001AES-GCM\u3001ChaCha20-Poly1305 \u7b49\u3002<\/li>\n
\n\u4f8b\u5982\uff1aRSA\u3001DSA\u3001ECDSA\u3001 DH\u3001ECDHE \u7b49\u3002<\/li>\n
\n\u4f8b\u5982\uff1aMD5\u3001SHA-1\u3001SHA-2\u3001SHA-256 \u7b49\u3002<\/li>\n
\n
\nHTTP \u8bf7\u6c42\u52ab\u6301<\/em><\/p>\n\n
\n\u6b64\u54cd\u5e94\u5934\u53ea\u6709\u5728 https \u8bbf\u95ee\u8fd4\u56de\u65f6\u624d\u751f\u6548\uff0c\u5176\u4e2d[ ]<\/span>\u4e2d\u7684\u53c2\u6570\u8868\u793a\u53ef\u9009\uff1b<\/li>\n
\n
\n\u5f00\u542f\u540e\u7b49\u7ea7\u53d8\u4e3a\uff1aA+
\n<\/p>\n\n