{"id":172399,"date":"2020-10-26T01:37:17","date_gmt":"2020-10-25T17:37:17","guid":{"rendered":"http:\/\/4563.org\/?p=172399"},"modified":"2020-10-26T01:37:17","modified_gmt":"2020-10-25T17:37:17","slug":"%e5%85%b3%e4%ba%8e-http-%e4%b8%ad%e7%9a%84-remote-address-%e5%92%8c-proxy_add_x_forwarded_for-%e9%97%ae%e9%a2%98%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=172399","title":{"rendered":"\u5173\u4e8e HTTP \u4e2d\u7684 Remote Address \u548c proxy_add_x_forwarded_for \u95ee\u9898\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5173\u4e8e HTTP \u4e2d\u7684 Remote Address \u548c proxy_add_x_forwarded_for \u95ee\u9898\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chinafengzhao <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u5728 HTTP \u4e2d\uff0c\u5982\u679c\u6ca1\u6709\u53cd\u5411\u4ee3\u7406\u548c\u6b63\u5411\u4ee3\u7406\u7684\u60c5\u51b5\uff0c\u6211\u4eec\u53ef\u4ee5\u5f88\u5bb9\u6613\u5728\u670d\u52a1\u7aef\u53d6\u5230\u5ba2\u6237\u7aef\u8bbf\u95ee\u8005\u7684 IP \u5730\u5740\u3002<\/p>\n<p>\u6309\u7167 https:\/\/imququ.com\/post\/x-forwarded-for-header-in-http.html \u8fd9\u7bc7\u535a\u5ba2\u4e2d\u63d0\u5230\u3002\u6211\u5728\u81ea\u5df1\u7684\u516c\u7f51\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4e86\u4e00\u4e2a nodejs \u7684 HTTP \u5e94\u7528\u3002\u7528\u6765\u6253\u5370\u5ba2\u6237\u7aef\u6240\u5728\u7684\u516c\u7f51 IP \u3002<\/p>\n<p>\u6211\u4eec\u77e5\u9053\uff0c\u5927\u90e8\u5206\u7ec8\u7aef\u8bbe\u5907\u4e0a\u7f51\uff0c\u90fd\u662f NAT \u4e0a\u7f51\uff0c\u90fd\u662f\u52a8\u6001 IP\uff0c\u6211\u5728\u81ea\u5df1\u7535\u8111\u4e0a\u540c\u65f6\u8bbf\u95ee\u6211\u81ea\u5df1\u516c\u7f51\u670d\u52a1\u5668\u7684 nodejs \u5e94\u7528\u3002\u4ee5\u53ca\u8bbf\u95ee http:\/\/httpbin.org\/ip\uff0c\u767e\u5ea6\u641c\u7d22 IP \u3002<\/p>\n<p>\u8fd9\u4e09\u4e2a IP \u90fd\u4e0d\u540c\uff0c\u6709\u6ca1\u6709\u7f51\u7edc\u5927\u795e\u89e3\u91ca\u4e00\u4e0b\u8fd9\u4e2a\u73b0\u8c61\u554a\uff1f      <\/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=\"3803026\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Mitt <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7406\u8bba\u4e0a\u8fd9\u4e09\u4e2a\u90fd\u5e94\u8be5\u662f\u540c\u4e00\u4e2a ip\uff0c\u786e\u8ba4\u4f60\u672c\u5730\u6ca1\u6709\u53d7\u4ee3\u7406\u5f71\u54cd\uff0c\u670d\u52a1\u5668\u662f\u76f4\u8fde\u800c\u6ca1\u6709\u8d70\u72ec\u7acb ip \u8d1f\u8f7d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3803027\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : virusdefender <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5565\u8fd0\u8425\u5546\uff0c\u79fb\u52a8\u4e4b\u7c7b\u7684 ip \u5404\u79cd\u98d8\u5f88\u6b63\u5e38                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3803028\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : opengps <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u81ea\u5df1 web \u7a0b\u5e8f\u83b7\u53d6\u7684\uff0c\u6309\u7406\u8bf4\u5e94\u8be5\u662f\u51c6\u7684\uff0c\u4e0d\u8fc7\u5982\u679c\u8ddf\u516c\u7f51\u5176\u4ed6\u5de5\u5177\u90fd\u4e0d\u540c\uff0c\u53ef\u80fd\u4f60\u7528\u7684\u65b9\u5f0f\u6709\u95ee\u9898\u3002<br \/>x-forward \u662f\u8f6c\u53d1\u65f6\u5019\u4f20\u9012\u7684\uff0c\u4e0d\u7ecf\u8fc7\u4ee3\u7406\u5e94\u8be5\u5c31\u662f\u7528\u6237\u63a5\u5165\u516c\u7f51\u73af\u8282\u7684 IP\uff0c\u4e0d\u8fc7\u8fd9\u4e2a\u5bb9\u6613\u6709\u5047<br \/>\u8bbf\u95ee\u516c\u7f51\u5de5\u5177\u67e5\u770b\u7684\uff0c\u9700\u8981\u786e\u8ba4\u4e0b\u5bf9\u65b9\u7684\u65b9\u6cd5\u662f\u4e0d\u662f\u51c6\u786e\uff0c\u6211\u7f51\u7ad9\u4e5f\u6709\uff0c\u4e00\u822c\u6765\u8bf4\u662f\u51c6\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3803029\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Leigg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u540e\u4e24\u4e2a\u4e00\u822c\u90fd\u662f\u4e00\u6837\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3803030\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : julyclyde <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             remote addr \u662f TCP \u8fde\u63a5\u7684\u201c\u5bf9\u65b9\u201d\u7684 IP \u5730\u5740<br \/>\u5982\u679c\u5bf9\u65b9\u5728 NAT \u540e\u9762\uff0c\u5f53\u7136\u5c31\u662f NAT \u7684\u51fa\u53e3\u5730\u5740<\/p>\n<p>x-forwarded-for \u662f\u4e00\u4e32 HTTP \u4ee3\u7406\u670d\u52a1\u5668\u4f20\u9012\u7684\u4fe1\u606f<\/p>\n<p>\u8fd9\u4fe9\u90fd\u4e0d\u662f\u540c\u4e00\u4e2a\u5c42\u6b21\u7684\u4e1c\u897f                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3803031\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : eudore <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6d89\u53ca\u4e00\u4e2a http \u91cc\u9762\u7684\u6982\u5ff5\u7aef\u5bf9\u7aef\u8df3\u5bf9\u8df3\u3002<\/p>\n<p>\u4ece\u670d\u52a1\u7684\u5165\u53e3 nginx \u5f00\u59cb\uff0c\u5230\u5904\u7406\u540e\u7aef\u4e00\u822c\u4f1a\u7ecf\u8fc7\u591a\u4e2a\u53cd\u5411\u4ee3\u7406\uff0c\u5728\u6bcf\u4e00\u4e2a\u53cd\u4ee3\u4f1a\u5c06\u4e0a\u4e00\u4e2a\u4ee3\u7406\u6216\u5ba2\u6237\u7aef\u7684\u5730\u5740\u52a0\u5165 x-forwarded-for \u91cc\u9762\uff0c\u53ef\u4ee5\u770b\u5230\u81ea\u5df1\u7684\u6d41\u91cf\u7ecf\u8fc7\u4e86\u90a3\u4e9b\u8282\u70b9,\u7b2c\u4e00\u4e2a\u4e00\u822c\u662f\u5ba2\u6237\u7aef\u771f\u5b9e ip\uff0c\u6709\u7684\u76f4\u63a5\u5728\u6700\u5916\u5c42\u8bbe\u7f6e Real-Ip \u8fd9\u4e2a header \u8bb0\u5f55\u5ba2\u6237\u7aef\u771f\u5b9e ip \u3002<\/p>\n<p>\u800c Remote Address \u662f tcp \u8fde\u63a5\u5230\u540e\u7aef\u5904\u7406\u8005\u7684 tcp ip\uff0c\u901a\u5e38\u662f\u6700\u8fd1\u4e00\u8df3\u7684 ip \u5730\u5740\uff0c\u5982\u679c\u7ecf\u8fc7\u4e86\u591a\u5c42\u4ee3\u7406\u540e\u8fd9\u4e2a remoteaddr \u662f\u6700\u8fd1\u4ee3\u7406\u5730\u5740\uff0c\u800c\u4e0d\u662f\u5ba2\u6237\u7aef\u5730\u5740\u4e86\uff0c\u670d\u52a1\u7aef\u83b7\u53d6\u5ba2\u6237\u7aef ip \u4e00\u822c\u5c31\u5148\u68c0\u67e5 x-forwarded-for \u7136\u540e\u624d\u53d6 remoteaddr \u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5173\u4e8e HTTP \u4e2d\u7684 Remote&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\/172399"}],"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=172399"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/172399\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=172399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=172399"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=172399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}