{"id":352183,"date":"2021-02-11T20:28:28","date_gmt":"2021-02-11T12:28:28","guid":{"rendered":"http:\/\/4563.org\/?p=352183"},"modified":"2021-02-11T20:28:28","modified_gmt":"2021-02-11T12:28:28","slug":"http-%e8%b7%a8%e5%9f%9f%e7%9a%84%e9%97%ae%e9%a2%98%ef%bc%88hsts%ef%bc%89","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=352183","title":{"rendered":"http \u8de8\u57df\u7684\u95ee\u9898\uff08hsts\uff09"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  http \u8de8\u57df\u7684\u95ee\u9898\uff08hsts\uff09               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : awanganddong <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u6d4f\u89c8\u5668\u8bf7\u6c42\u540e\u53f0\u63a5\u53e3\u62a5\u9519\u5982\u4e0b<\/p>\n<pre><code>Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request. <\/code><\/pre>\n<p>\u540e\u53f0 nginx \u914d\u7f6e\u4e86 strict-transport-security \u53c2\u6570 \u67e5\u770b\u65e5\u5fd7\u672a\u6536\u5230\u524d\u7aef\u8bf7\u6c42 \u524d\u7aef\u6e05\u695a\u7f13\u5b58\u540e\u518d\u6b21\u8bf7\u6c42\u53c8\u6210\u529f\u4e86\uff0c\u8fc7\u4f1a\u5c31\u4f1a\u53c8\u5931\u8d25 \u5b9a\u4f4d\u5230\u95ee\u9898\u662f\u8bf7\u6c42\u63a5\u53e3\u662f https \u7684\u4f46\u662f\u63a5\u53e3\u8bf7\u6c42\u7684\u662f http<\/p>\n<p>\u4f46\u662f\u5bf9\u4e8e\u51fa\u73b0\u8fd9\u79cd\u60c5\u51b5\u7684\u539f\u56e0\u8fd8\u662f\u4e0d\u592a\u6e05\u695a\u3002<\/p>\n<p>\u8fd9\u662f\u77e5\u4e4e\u4e0a\u8fb9\u7684\u4e00\u7bc7\u8bb2\u89e3\u3002<\/p>\n<p>https:\/\/zhuanlan.zhihu.com\/p\/245511588<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>6<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5326115\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : awanganddong <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5f53\u7528\u6237\u5df2\u7ecf\u5b89\u5168\u7684\u767b\u5f55\u5f00\u542f\u8fc7 htst \u529f\u80fd\u7684\u7f51\u7ad9 (\u652f\u6301 hsts \u529f\u80fd\u7684\u7ad9\u70b9\u4f1a\u5728\u54cd\u5e94\u5934\u4e2d\u63d2\u5165\uff1aStrict-Transport-Security) \u4e4b\u540e\uff0c\u652f\u6301 htst \u7684\u6d4f\u89c8\u5668(\u6bd4\u5982 chrome. firefox)\u4f1a\u81ea\u52a8\u5c06\u8fd9\u4e2a\u57df\u540d\u52a0\u5165\u5230 HSTS \u5217\u8868\uff0c\u4e0b\u6b21\u5373\u4f7f\u7528\u6237\u4f7f\u7528 http \u8bbf\u95ee\u8fd9\u4e2a\u7f51\u7ad9\uff0c\u652f\u6301 htst \u529f\u80fd\u7684\u6d4f\u89c8\u5668\u5c31\u4f1a\u81ea\u52a8\u53d1\u9001 https \u8bf7\u6c42\uff08\u524d\u63d0\u662f\u7528\u6237\u6ca1\u6709\u6e05\u7a7a\u7f13\u5b58\uff0c\u5982\u679c\u6e05\u7a7a\u4e86\u7f13\u5b58\u7b2c\u4e00\u6b21\u8bbf\u95ee\u8fd8\u662f\u660e\u6587\uff0c\u540e\u7eed\u6d4f\u89c8\u5668\u63a5\u6536\u5230\u670d\u52a1\u5668\u54cd\u5e94\u5934\u4e2d\u7684 Strict-Transport-Security\uff0c\u5c31\u4f1a\u628a\u57df\u540d\u52a0\u5165\u5230 hsts \u7f13\u5b58\u4e2d\uff0c\u7136\u540e\u624d\u4f1a\u5728\u53d1\u9001\u8bf7\u6c42\u524d\u5c06 http \u5185\u90e8\u8f6c\u6362\u6210 https \uff09\uff0c\u800c\u4e0d\u662f\u5148\u53d1\u9001 http\uff0c\u7136\u540e\u91cd\u5b9a\u5411\u5230 https\uff0c\u8fd9\u6837\u5c31\u80fd\u907f\u514d\u4e2d\u9014\u7684 302 \u91cd\u5b9a\u5411 URL \u88ab\u7be1\u6539\u3002\u8fdb\u4e00\u6b65\u63d0\u9ad8\u901a\u4fe1\u7684\u5b89\u5168\u6027\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5326116\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : awanganddong <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u8fd9\u6837\u7406\u89e3\u4e0d\u77e5\u9053\u5bf9\u4e0d\u5bf9<\/p>\n<p>1.\u7528\u6237\u9996\u6b21 http \u8bf7\u6c42\uff0c\u9996\u5148\u53d1 option \u9884\u68c0\u8bf7\u6c42\uff08\u8d70 http \uff09\uff0c\u901a\u8fc7\u4e4b\u540e\u6b63\u5f0f post \u8bf7\u6c42(\u8d70 http)\u3002 \u8fd9\u65f6\u5019 strict-transport-security \u4f1a\u628a\u57df\u540d\u52a0\u5165 hsts \u7f13\u5b58\u4e2d\u3002<br \/>2.\u7b2c\u4e8c\u6b21\u8bf7\u6c42\uff0c\u9884\u68c0\u8bf7\u6c42\uff08\u8d70 http \uff09\uff0c\u901a\u8fc7\u4e4b\u540e\u6b63\u5f0f\u8bf7\u6c42\uff08\u8d70 hsts \u7f13\u5b58\uff09\u3002\u8de8\u57df\u5931\u8d25\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5326117\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : no1xsyzy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e00\u65e6 HSTS \u5c31\u4e0d\u8981\u60f3\u7740 HTTP\uff0c\u6839\u672c\u6ca1\u6709 \u201c\u63a5\u53e3\u8bf7\u6c42\u7684\u662f http\u201d \u4e00\u8bf4\uff0c\u90fd\u662f HTTPS\uff0c\u4e00\u65e6\u5728 HSTS \u671f\u9650\u5185\uff0c\u6c38\u8fdc\u4e0d\u53ef\u80fd\u53d1\u51fa HTTP\uff0c\u53d1\u51fa\u6765\u8bf7\u76f4\u63a5\u62a5 security bug \u7ed9\u5bf9\u5e94\u6d4f\u89c8\u5668\u3002\uff08 localhost \u9664\u5916\uff09<\/p>\n<p>\u4e0d\u77e5\u9053\u4f60\u4e3a\u4ec0\u4e48\u4f1a 3xx\uff0cOPTIONS \u4f3c\u4e4e\u4e0d\u5141\u8bb8 3xx                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5326118\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : markgor <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982 3L \u6240\u8a00\uff0c<br \/>1 \u3001HSTS \u5f00\u542f\u540e\uff0c\u65f6\u95f4\u8303\u56f4\u5185\u8d70\u7684\u90fd\u662f HTTPS \u3002<br \/>2 \u3001ajax \u8de8\u57df\u6d41\u7a0b\uff1a<br \/>\u6d4f\u89c8\u5668\u5224\u65ad ajax \u662f\u5426\u8de8\u57df\uff0c<br \/>\u53d1\u9001 option \u8bf7\u6c42\u5230 ajax \u8bf7\u6c42\u7684 url<br \/>\u8fd4\u56de header \u5305\u542b\u5141\u8bb8\u8de8\u57df\u4fe1\u606f\u518d\u6b21\u53d1\u9001 ajax \u8bf7\u6c42\u3002<\/p>\n<p>\u4f60\u73b0\u5728\u7684\u95ee\u9898\u5e94\u8be5\u662f\u8bf4 ajax \u9996\u6b21\u8bbf\u95ee\u7684\u662f http \u7684 url \u5730\u5740\uff0c<br \/>\u5bfc\u81f4 option \u8bbf\u95ee\u7684\u4e5f\u662f http \u5730\u5740\u3002<br \/>\u65e2\u7136\u662f\u8de8\u57df\uff0c\u524d\u7aef\u4e3a\u4f55\u4e0d\u76f4\u63a5\u5199\u6b7b\u8bf7\u6c42\u5730\u5740\u4e3a https \u5462\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5326119\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : awanganddong <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5c31\u662f\u6211\u540e\u53f0\u63d0\u4f9b\u7684\u63a5\u53e3\u662f https \u7684{http \u4e5f\u53ef\u4ee5\u7528}\uff0c\u4f46\u662f\u524d\u7aef\u8bf7\u6c42\u6211\u63a5\u53e3\u7528\u7684\u662f http\uff0c\u7136\u540e\u5c31\u62a5\u9519\u4e86\u3002<\/p>\n<p>\u6211\u73b0\u5728\u5bf9\u62a5\u9519\u8fd9\u4e2a\u73af\u8282\u4e0d\u592a\u7406\u89e3\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5326120\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : beastk <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             hsts \u65e0\u6cd5\u964d\u7ea7                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>http \u8de8\u57df\u7684\u95ee\u9898\uff08hsts\uff09 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/352183"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=352183"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/352183\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=352183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=352183"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=352183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}