{"id":128339,"date":"2020-06-20T00:12:07","date_gmt":"2020-06-19T16:12:07","guid":{"rendered":"http:\/\/4563.org\/?p=128339"},"modified":"2020-06-20T00:12:07","modified_gmt":"2020-06-19T16:12:07","slug":"nginx-%e5%a6%82%e4%bd%95%e9%99%90%e5%88%b6%e7%9b%b8%e5%90%8c-request_body-%e7%9a%84%e8%ae%bf%e9%97%ae%e9%a2%91%e7%8e%87","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=128339","title":{"rendered":"Nginx \u5982\u4f55\u9650\u5236\u76f8\u540c request_body \u7684\u8bbf\u95ee\u9891\u7387"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Nginx \u5982\u4f55\u9650\u5236\u76f8\u540c request_body \u7684\u8bbf\u95ee\u9891\u7387               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : aoscici2000 <\/span>  <span><i><\/i> 76<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<pre><code>limit_req_zone $request_body zone=myzone:10m rate=2r\/s;  server {     location \/push {         limit_except POST {             deny  all;         }         limit_req zone=myzone burst=2 nodelay;         ...     } } <\/code><\/pre>\n<p>\u5982\u4e0a, \u6211\u5e0c\u671b\u80fd\u9650\u5236\u76f8\u540c request_body \u7684\u8bbf\u95ee\u9891\u7387, \u597d\u50cf\u4e0d\u8d77\u4f5c\u7528?<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"40878\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lihongjie0209 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u8ba1\u7b97\u4e00\u4e0b request_body \u7684 hash \u653e\u5230 header \u4e2d\uff0c \u7136\u540e\u6839\u636e header \u53bb\u91cd\u5c31\u53ef\u4ee5\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"40879\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : rrfeng <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @lihongjie0209 <br \/>\u60f3\u5f53\u7136\u4e86\uff0c\u4e86\u89e3\u4e00\u4e0b Nginx \u7684\u5904\u7406\u9636\u6bb5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"40880\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lihongjie0209 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @rrfeng #2 \u5bf9\u54e6\uff0c \u5148\u5904\u7406 header \u518d\u5904\u7406 bady\uff0c \u641e\u53cd\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"40881\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lihongjie0209 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @rrfeng #2 \u8981\u4e0d\u524d\u7aef\u505a\u8fd9\u4e2a hash \uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"40882\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : caryqy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6362\u4e2a\u65b9\u5f0f,\u901a\u8fc7 redis \u6765,md5 \u6bcf\u6b21\u8bf7\u6c42\u6dfb\u52a0\u5230 redis \u4e2d,\u8bbe\u7f6e\u4e00\u4e2a\u8fc7\u671f\u65f6\u95f4,\u4e0b\u4e2a\u8bf7\u6c42\u5148\u5224\u65ad redis \u4e2d\u662f\u5426\u5b58\u5728, \u9891\u7387\u901a\u8fc7\u8fc7\u671f\u65f6\u95f4\u6765\u63a7\u5236                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"40883\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cydleadingx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             openresty \u5904\u7406\u4e0b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"40884\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : aoscici2000 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @cydleadingx \u4e3a\u4e86\u4e00\u4e2a\u8f85\u52a9\u6027\u529f\u80fd\u7684\u8bdd, \u5b66\u4e60\u6210\u672c\u592a\u5927\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"40885\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cydleadingx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @aoscici2000 \u4e00\u5929\u800c\u5df2                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"40886\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : aoscici2000 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @lihongjie0209 \u6211\u8bd5\u4e86\u4e00\u4e0b\u591a\u505a\u4e00\u5c42\u4ee3\u7406, \u7b2c\u4e00\u5c42\u628a request_body \u6dfb\u52a0\u5230 header, \u7531\u7b2c\u4e8c\u5c42\u505a\u53bb\u91cd, \u4f46\u597d\u50cf\u4e0d\u592a\u6210\u529f, \u4e0d\u77e5\u9053 header \u662f\u600e\u4e48\u8bbe\u7f6e\u7684? \u80fd\u5426\u6307\u70b9\u4e00\u4e0b ^^<\/p>\n<p>limit_req_zone $http_HEADER zone=myzone:10m rate=1r\/s;<\/p>\n<p>location \/a {<br \/> proxy_pass http:\/\/127.0.0.1\/b;<br \/> add_header data $request_body;<br \/>}<\/p>\n<p>location \/b {<br \/> proxy_pass http:\/\/127.0.0.1\/real-addr;<br \/> limit_req zone=myzone burst=2 nodelay;<br \/>}                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Nginx \u5982\u4f55\u9650\u5236\u76f8\u540c requ&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\/128339"}],"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=128339"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/128339\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=128339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=128339"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=128339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}