{"id":50601,"date":"2024-10-08T12:25:14","date_gmt":"2024-10-08T04:25:14","guid":{"rendered":"https:\/\/server.hk\/cnblog\/50601\/"},"modified":"2024-10-08T12:25:15","modified_gmt":"2024-10-08T04:25:15","slug":"nginx-%e5%ae%89%e5%85%a8%e7%ad%96%e7%95%a5%ef%bc%9a%e7%a6%81%e7%94%a8-trace-%e6%96%b9%e6%b3%95%e4%bb%a5%e9%98%b2%e6%ad%a2-xst-%e6%94%bb%e6%93%8a","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/50601\/","title":{"rendered":"Nginx \u5b89\u5168\u7b56\u7565\uff1a\u7981\u7528 TRACE \u65b9\u6cd5\u4ee5\u9632\u6b62 XST \u653b\u64ca"},"content":{"rendered":"<h1 id=\"nginx-%e5%ae%89%e5%85%a8%e7%ad%96%e7%95%a5%ef%bc%9a%e7%a6%81%e7%94%a8-trace-%e6%96%b9%e6%b3%95%e4%bb%a5%e9%98%b2%e6%ad%a2-xst-%e6%94%bb%e6%93%8a-DrwJNpDxaT\">Nginx \u5b89\u5168\u7b56\u7565\uff1a\u7981\u7528 TRACE \u65b9\u6cd5\u4ee5\u9632\u6b62 XST \u653b\u64ca<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u7db2\u7d61\u74b0\u5883\u4e2d\uff0c\u7db2\u7ad9\u5b89\u5168\u6027\u5df2\u6210\u70ba\u6bcf\u500b\u7db2\u7ad9\u7ba1\u7406\u54e1\u5fc5\u9808\u91cd\u8996\u7684\u8b70\u984c\u3002\u96a8\u8457\u7db2\u7d61\u653b\u64ca\u624b\u6cd5\u7684\u65e5\u76ca\u589e\u591a\uff0c\u7db2\u7ad9\u7684\u9632\u8b77\u63aa\u65bd\u4e5f\u5fc5\u9808\u4e0d\u65b7\u66f4\u65b0\u548c\u52a0\u5f37\u3002\u5176\u4e2d\uff0c\u7981\u7528 HTTP TRACE \u65b9\u6cd5\u662f\u4e00\u9805\u91cd\u8981\u7684\u5b89\u5168\u7b56\u7565\uff0c\u80fd\u6709\u6548\u9632\u6b62\u8de8\u7ad9\u8ffd\u8e64\uff08Cross-Site Tracing, XST\uff09\u653b\u64ca\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af-trace-%e6%96%b9%e6%b3%95%ef%bc%9f-DrwJNpDxaT\">\u4ec0\u9ebc\u662f TRACE \u65b9\u6cd5\uff1f<\/h2>\n<p>HTTP TRACE \u65b9\u6cd5\u662f\u4e00\u7a2e\u7528\u65bc\u8a3a\u65b7\u7684\u8acb\u6c42\u65b9\u6cd5\uff0c\u5141\u8a31\u5ba2\u6236\u7aef\u5411\u670d\u52d9\u5668\u767c\u9001\u8acb\u6c42\uff0c\u4e26\u8981\u6c42\u670d\u52d9\u5668\u8fd4\u56de\u8a72\u8acb\u6c42\u7684\u539f\u59cb\u5167\u5bb9\u3002\u9019\u5728\u67d0\u4e9b\u60c5\u6cc1\u4e0b\u53ef\u4ee5\u7528\u4f86\u6aa2\u67e5\u8acb\u6c42\u662f\u5426\u5728\u7db2\u7d61\u4e2d\u88ab\u4fee\u6539\u3002\u7136\u800c\uff0c\u9019\u7a2e\u529f\u80fd\u4e5f\u53ef\u80fd\u88ab\u60e1\u610f\u7528\u6236\u5229\u7528\uff0c\u9032\u884c XST \u653b\u64ca\u3002<\/p>\n<h2 id=\"xst-%e6%94%bb%e6%93%8a%e7%9a%84%e5%8e%9f%e7%90%86-DrwJNpDxaT\">XST \u653b\u64ca\u7684\u539f\u7406<\/h2>\n<p>XST \u653b\u64ca\u662f\u4e00\u7a2e\u5229\u7528 TRACE \u65b9\u6cd5\u7684\u653b\u64ca\u624b\u6cd5\u3002\u653b\u64ca\u8005\u53ef\u4ee5\u901a\u904e\u767c\u9001\u7279\u88fd\u7684\u8acb\u6c42\uff0c\u7372\u53d6\u7528\u6236\u7684\u654f\u611f\u4fe1\u606f\uff0c\u4f8b\u5982 Cookie \u6216\u5176\u4ed6\u8eab\u4efd\u9a57\u8b49\u4fe1\u606f\u3002\u9019\u4e9b\u4fe1\u606f\u53ef\u4ee5\u88ab\u7528\u4f86\u9032\u884c\u8eab\u4efd\u76dc\u7aca\u6216\u5176\u4ed6\u60e1\u610f\u884c\u70ba\u3002<\/p>\n<p>\u5177\u9ad4\u4f86\u8aaa\uff0c\u653b\u64ca\u8005\u53ef\u4ee5\u5229\u7528 XST \u653b\u64ca\u4f86\u7372\u53d6\u7528\u6236\u7684 Cookie\uff0c\u7136\u5f8c\u5229\u7528\u9019\u4e9b Cookie \u9032\u884c\u672a\u7d93\u6388\u6b0a\u7684\u64cd\u4f5c\u3002\u9019\u4f7f\u5f97\u7db2\u7ad9\u7684\u5b89\u5168\u6027\u53d7\u5230\u5a01\u8105\uff0c\u7279\u5225\u662f\u5c0d\u65bc\u9700\u8981\u7528\u6236\u767b\u9304\u7684\u7db2\u7ad9\u3002<\/p>\n<h2 id=\"%e5%a6%82%e4%bd%95%e5%9c%a8-nginx-%e4%b8%ad%e7%a6%81%e7%94%a8-trace-%e6%96%b9%e6%b3%95-DrwJNpDxaT\">\u5982\u4f55\u5728 Nginx \u4e2d\u7981\u7528 TRACE \u65b9\u6cd5<\/h2>\n<p>\u70ba\u4e86\u9632\u6b62 XST \u653b\u64ca\uff0c\u5efa\u8b70\u5728 Nginx \u4f3a\u670d\u5668\u4e2d\u7981\u7528 TRACE \u65b9\u6cd5\u3002\u4ee5\u4e0b\u662f\u5177\u9ad4\u7684\u64cd\u4f5c\u6b65\u9a5f\uff1a<\/p>\n<pre><code>server {\n    listen 80;\n    server_name yourdomain.com;\n\n    # \u7981\u7528 TRACE \u65b9\u6cd5\n    if ($request_method = TRACE) {\n        return 405;\n    }\n\n    # \u5176\u4ed6\u914d\u7f6e...\n}<\/code><\/pre>\n<p>\u5728\u4e0a\u8ff0\u914d\u7f6e\u4e2d\uff0c\u7576\u4f3a\u670d\u5668\u63a5\u6536\u5230 TRACE \u8acb\u6c42\u6642\uff0c\u5c07\u8fd4\u56de 405 \u932f\u8aa4\uff0c\u8868\u793a\u4e0d\u5141\u8a31\u8a72\u8acb\u6c42\u65b9\u6cd5\u3002\u9019\u6a23\u53ef\u4ee5\u6709\u6548\u9632\u6b62 XST \u653b\u64ca\u3002<\/p>\n<h2 id=\"%e5%85%b6%e4%bb%96%e5%ae%89%e5%85%a8%e5%bb%ba%e8%ad%b0-DrwJNpDxaT\">\u5176\u4ed6\u5b89\u5168\u5efa\u8b70<\/h2>\n<ul>\n<li><strong>\u4f7f\u7528 HTTPS\uff1a<\/strong>\u78ba\u4fdd\u6240\u6709\u7684\u6578\u64da\u50b3\u8f38\u90fd\u662f\u52a0\u5bc6\u7684\uff0c\u9019\u6a23\u53ef\u4ee5\u9632\u6b62\u4e2d\u9593\u4eba\u653b\u64ca\u3002<\/li>\n<li><strong>\u8a2d\u7f6e\u9069\u7576\u7684 CORS \u7b56\u7565\uff1a<\/strong>\u901a\u904e\u8a2d\u7f6e\u8de8\u6e90\u8cc7\u6e90\u5171\u4eab\uff08CORS\uff09\u7b56\u7565\uff0c\u9650\u5236\u54ea\u4e9b\u57df\u540d\u53ef\u4ee5\u8a2a\u554f\u4f60\u7684\u8cc7\u6e90\u3002<\/li>\n<li><strong>\u5b9a\u671f\u66f4\u65b0 Nginx\uff1a<\/strong>\u4fdd\u6301 Nginx \u7684\u6700\u65b0\u7248\u672c\uff0c\u4ee5\u7372\u53d6\u6700\u65b0\u7684\u5b89\u5168\u4fee\u88dc\u548c\u529f\u80fd\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96-DrwJNpDxaT\">\u7d50\u8ad6<\/h2>\n<p>\u7981\u7528 TRACE \u65b9\u6cd5\u662f\u63d0\u9ad8\u7db2\u7ad9\u5b89\u5168\u6027\u7684\u4e00\u500b\u91cd\u8981\u6b65\u9a5f\uff0c\u7279\u5225\u662f\u5728\u9632\u6b62 XST \u653b\u64ca\u65b9\u9762\u3002\u901a\u904e\u7c21\u55ae\u7684 Nginx \u914d\u7f6e\uff0c\u7db2\u7ad9\u7ba1\u7406\u54e1\u53ef\u4ee5\u6709\u6548\u5730\u4fdd\u8b77\u7528\u6236\u7684\u654f\u611f\u4fe1\u606f\uff0c\u6e1b\u5c11\u6f5b\u5728\u7684\u5b89\u5168\u98a8\u96aa\u3002\u96a8\u8457\u7db2\u7d61\u5b89\u5168\u5a01\u8105\u7684\u589e\u52a0\uff0c\u6301\u7e8c\u95dc\u6ce8\u548c\u66f4\u65b0\u5b89\u5168\u7b56\u7565\u662f\u6bcf\u500b\u7db2\u7ad9\u7ba1\u7406\u54e1\u7684\u8cac\u4efb\u3002<\/p>\n<p>\u5982\u9700\u4e86\u89e3\u66f4\u591a\u6709\u95dc <a href=\"https:\/\/server.hk\">\u9999\u6e2f VPS<\/a> \u53ca\u5176\u5b89\u5168\u914d\u7f6e\u7684\u8cc7\u8a0a\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3\u5982\u4f55\u5728 Nginx \u4e2d\u7981\u7528 TRACE \u65b9\u6cd5\uff0c\u4ee5\u9632\u6b62\u8de8\u7ad9\u8ddf\u8e2a\uff08XST\uff09\u653b\u51fb\uff0c\u589e\u5f3a\u7f51\u7ad9\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-50601","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/50601","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=50601"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/50601\/revisions"}],"predecessor-version":[{"id":50602,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/50601\/revisions\/50602"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=50601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=50601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=50601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}