{"id":102791,"date":"2026-09-09T14:17:04","date_gmt":"2026-09-09T06:17:04","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/102791.html"},"modified":"2026-09-09T14:17:04","modified_gmt":"2026-09-09T06:17:04","slug":"%e5%89%8d%e7%ab%af%e6%9e%b6%e6%9e%84%e5%ae%9e%e6%88%98%ef%bc%9a%e5%bd%93%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%85%b3%e9%97%ad%e6%97%b6%ef%bc%8c%e5%a6%82%e4%bd%95%e4%bc%98%e9%9b%85%e6%8f%90%e7%a4%ba-502","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/102791.html","title":{"rendered":"\u524d\u7aef\u67b6\u6784\u5b9e\u6218\uff1a\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6\uff0c\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef\uff1f"},"content":{"rendered":"<h2>\u524d\u7aef\u67b6\u6784\u5b9e\u6218&#xff1a;\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6&#xff0c;\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef&#xff1f;<\/h2>\n<p>\u5728\u5f00\u53d1\u4e0e\u8fd0\u7ef4\u8fc7\u7a0b\u4e2d&#xff0c;\u540e\u7aef\u670d\u52a1\u91cd\u542f\u6216\u5b95\u673a\u662f\u5e38\u6709\u7684\u4e8b\u3002\u6b64\u65f6&#xff0c;Nginx \u4f1a\u5411\u6d4f\u89c8\u5668\u8fd4\u56de 502 Bad Gateway \u72b6\u6001\u7801\u3002<br \/>\n\u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;Axios \u4f1a\u629b\u51fa Request failed with status code 502 \u8fd9\u6837\u7684\u539f\u59cb\u9519\u8bef\u4fe1\u606f\u3002\u8fd9\u5bf9\u666e\u901a\u7528\u6237\u6765\u8bf4\u4e0d\u4ec5\u6666\u6da9\u96be\u61c2&#xff0c;\u8fd8\u5bb9\u6613\u5f15\u8d77\u6050\u614c\u3002\u4f5c\u4e3a\u524d\u7aef\u67b6\u6784\u5e08&#xff0c;\u6211\u4eec\u9700\u8981\u5728\u5168\u5c40\u62e6\u622a\u5668\u5c42\u9762\u201c\u6d88\u5316\u201d\u8fd9\u4e9b\u6280\u672f\u6027\u9519\u8bef&#xff0c;\u7ed9\u7528\u6237\u5c55\u793a\u53cb\u597d\u7684\u63d0\u793a\u3002<br \/>\n\u672c\u6587\u5c06\u5e26\u4f60\u4f18\u5316 common.js \u4e2d\u7684\u54cd\u5e94\u62e6\u622a\u5668&#xff0c;\u5b9e\u73b0\u5bf9\u670d\u52a1\u4e0d\u53ef\u7528\u72b6\u6001\u7684\u4f18\u96c5\u5904\u7406\u3002<\/p>\n<h4>\u4e00\u3001 \u6838\u5fc3\u4fee\u590d\u903b\u8f91<\/h4>\n<p>\u6211\u4eec\u9700\u8981\u5728\u54cd\u5e94\u62e6\u622a\u5668\u7684\u5f02\u5e38\u5904\u7406\u51fd\u6570\u4e2d&#xff0c;\u5bf9 HTTP \u72b6\u6001\u7801\u8fdb\u884c\u5206\u5c42\u5904\u7406\u3002\u4f18\u5148\u5904\u7406\u670d\u52a1\u5668\u6545\u969c\u7c7b\u9519\u8bef&#xff08;502\/503\/504&#xff09;&#xff0c;\u5176\u6b21\u662f\u4e1a\u52a1\u9650\u6d41&#xff08;429&#xff09;&#xff0c;\u6700\u540e\u624d\u662f\u5e38\u89c4\u7684\u4e1a\u52a1\u5f02\u5e38\u3002<br \/>\n\u4ee5\u4e0b\u662f\u4f18\u5316\u540e\u7684 common.js \u5f02\u5e38\u5904\u7406\u90e8\u5206\u4ee3\u7801&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; B. \u5f02\u5e38\u54cd\u5e94 (401, 429, 500, 502 \u7b49) &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/span><br \/>\n<span class=\"token keyword\">async<\/span> <span class=\"token keyword\">function<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token parameter\">error<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> originalRequest <span class=\"token operator\">&#061;<\/span> error<span class=\"token punctuation\">.<\/span>config<span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> response <span class=\"token operator\">&#061;<\/span> error<span class=\"token punctuation\">.<\/span>response<span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token comment\">\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><br \/>\n  <span class=\"token comment\">\/\/ 1. \u670d\u52a1\u5668\u6545\u969c\u7c7b\u62e6\u622a (502, 503, 504)<\/span><br \/>\n  <span class=\"token comment\">\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>response<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> status <span class=\"token operator\">&#061;<\/span> response<span class=\"token punctuation\">.<\/span>status<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token comment\">\/\/ 502: \u7f51\u5173\u9519\u8bef&#xff08;\u540e\u7aef\u670d\u52a1\u672a\u542f\u52a8\u6216Nginx\u8fde\u63a5\u4e0d\u4e0a\u540e\u7aef&#xff09;<\/span><br \/>\n    <span class=\"token comment\">\/\/ 503: \u670d\u52a1\u4e0d\u53ef\u7528&#xff08;\u540e\u7aef\u670d\u52a1\u8fc7\u8f7d\u6216\u6b63\u5728\u7ef4\u62a4&#xff09;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>status <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token number\">502<\/span> <span class=\"token operator\">||<\/span> status <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token number\">503<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token keyword\">return<\/span> Promise<span class=\"token punctuation\">.<\/span><span class=\"token function\">reject<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u670d\u52a1\u5668\u6b63\u5728\u7ef4\u62a4\u6216\u5df2\u5173\u95ed&#xff0c;\u8bf7\u7a0d\u540e\u518d\u8bd5&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token comment\">\/\/ 504: \u7f51\u5173\u8d85\u65f6&#xff08;\u540e\u7aef\u5904\u7406\u65f6\u95f4\u8fc7\u957f&#xff09;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>status <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token number\">504<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token keyword\">return<\/span> Promise<span class=\"token punctuation\">.<\/span><span class=\"token function\">reject<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u7f51\u7edc\u8fde\u63a5\u8d85\u65f6&#xff0c;\u8bf7\u91cd\u8bd5&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>error<span class=\"token punctuation\">.<\/span>message<span class=\"token punctuation\">.<\/span><span class=\"token function\">includes<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;Network Error&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u670d\u52a1\u5668\u5b8c\u5168\u6ca1\u54cd\u5e94&#xff08;\u8fde Nginx \u90fd\u6ca1\u5f00&#xff09;\u6216\u8005\u672c\u5730\u65ad\u7f51<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u6b64\u65f6 response \u5bf9\u8c61\u4e0d\u5b58\u5728&#xff0c;\u9700\u8981\u901a\u8fc7 error.message \u5224\u65ad<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> Promise<span class=\"token punctuation\">.<\/span><span class=\"token function\">reject<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u65e0\u6cd5\u8fde\u63a5\u5230\u670d\u52a1\u5668&#xff0c;\u8bf7\u68c0\u67e5\u7f51\u7edc&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token comment\">\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><br \/>\n  <span class=\"token comment\">\/\/ 2. 429 \u9650\u6d41\u62e6\u622a<\/span><br \/>\n  <span class=\"token comment\">\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>response <span class=\"token operator\">&amp;&amp;<\/span> response<span class=\"token punctuation\">.<\/span>status <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token number\">429<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> msg <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">(<\/span>response<span class=\"token punctuation\">.<\/span>data <span class=\"token operator\">&amp;&amp;<\/span> response<span class=\"token punctuation\">.<\/span>data<span class=\"token punctuation\">.<\/span>errorMsg<span class=\"token punctuation\">)<\/span><br \/>\n                <span class=\"token operator\">?<\/span> response<span class=\"token punctuation\">.<\/span>data<span class=\"token punctuation\">.<\/span>errorMsg<br \/>\n                <span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;\u8bf7\u6c42\u8fc7\u4e8e\u9891\u7e41&#xff0c;\u8bf7\u7a0d\u540e\u518d\u8bd5&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> Promise<span class=\"token punctuation\">.<\/span><span class=\"token function\">reject<\/span><span class=\"token punctuation\">(<\/span>msg<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token comment\">\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><br \/>\n  <span class=\"token comment\">\/\/ 3. 401 \u4e3b\u52a8\u5237\u65b0\u903b\u8f91<\/span><br \/>\n  <span class=\"token comment\">\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><br \/>\n    response <span class=\"token operator\">&amp;&amp;<\/span><br \/>\n    response<span class=\"token punctuation\">.<\/span>status <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token number\">401<\/span> <span class=\"token operator\">&amp;&amp;<\/span><br \/>\n    <span class=\"token operator\">!<\/span>originalRequest<span class=\"token punctuation\">.<\/span>url<span class=\"token punctuation\">.<\/span><span class=\"token function\">includes<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\/user\/refresh&#034;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&amp;&amp;<\/span><br \/>\n    <span class=\"token operator\">!<\/span>originalRequest<span class=\"token punctuation\">.<\/span>_retry<br \/>\n  <span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token comment\">\/\/ &#8230; (\u6b64\u5904\u4fdd\u6301\u4f60\u539f\u6709\u7684 Token \u5237\u65b0\u903b\u8f91\u4e0d\u53d8) &#8230;<\/span><br \/>\n      <span class=\"token comment\">\/\/ \u6ce8\u610f&#xff1a;\u5982\u679c\u670d\u52a1\u7aef 502&#xff0c;\u4e0a\u9762\u5df2\u7ecf\u62e6\u622a\u5e76 reject \u4e86&#xff0c;\u4e0d\u4f1a\u8d70\u5230\u8fd9\u91cc\u3002<\/span><br \/>\n      <span class=\"token comment\">\/\/ \u53ea\u6709\u72b6\u6001\u7801\u786e\u5b9e\u662f 401 \u65f6\u624d\u4f1a\u8fdb\u5165\u6b64\u5206\u652f\u3002<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token comment\">\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><br \/>\n  <span class=\"token comment\">\/\/ 4. \u6700\u7ec8\u515c\u5e95&#xff1a;\u72b6\u6001\u7801\u6620\u5c04\u4e0e\u9ed8\u8ba4\u63d0\u793a<\/span><br \/>\n  <span class=\"token comment\">\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><br \/>\n  <span class=\"token comment\">\/\/ \u5b9a\u4e49\u5e38\u89c1 HTTP \u72b6\u6001\u7801\u7684\u53cb\u597d\u63d0\u793a\u6620\u5c04<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> statusTextMap <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token number\">400<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;\u8bf7\u6c42\u53c2\u6570\u9519\u8bef&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token number\">404<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;\u8bf7\u6c42\u8d44\u6e90\u4e0d\u5b58\u5728&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token number\">405<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;\u8bf7\u6c42\u65b9\u5f0f\u4e0d\u6b63\u786e&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token number\">500<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;\u670d\u52a1\u5668\u5185\u90e8\u5f02\u5e38&#034;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token comment\">\/\/ \u4f18\u5148\u53d6\u540e\u7aef\u8fd4\u56de\u7684 errorMsg&#xff0c;\u5176\u6b21\u53d6\u6620\u5c04\u8868\u6587\u6848&#xff0c;\u6700\u540e\u515c\u5e95<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> finalMsg <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">(<\/span>response <span class=\"token operator\">&amp;&amp;<\/span> response<span class=\"token punctuation\">.<\/span>data <span class=\"token operator\">&amp;&amp;<\/span> response<span class=\"token punctuation\">.<\/span>data<span class=\"token punctuation\">.<\/span>errorMsg<span class=\"token punctuation\">)<\/span><br \/>\n                   <span class=\"token operator\">?<\/span> response<span class=\"token punctuation\">.<\/span>data<span class=\"token punctuation\">.<\/span>errorMsg<br \/>\n                   <span class=\"token operator\">:<\/span> <span class=\"token punctuation\">(<\/span>response <span class=\"token operator\">&amp;&amp;<\/span> statusTextMap<span class=\"token punctuation\">[<\/span>response<span class=\"token punctuation\">.<\/span>status<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n                   <span class=\"token operator\">?<\/span> statusTextMap<span class=\"token punctuation\">[<\/span>response<span class=\"token punctuation\">.<\/span>status<span class=\"token punctuation\">]<\/span><br \/>\n                   <span class=\"token operator\">:<\/span> <span class=\"token punctuation\">(<\/span>error<span class=\"token punctuation\">.<\/span>message <span class=\"token operator\">||<\/span> <span class=\"token string\">&#034;\u7cfb\u7edf\u7e41\u5fd9&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token keyword\">return<\/span> Promise<span class=\"token punctuation\">.<\/span><span class=\"token function\">reject<\/span><span class=\"token punctuation\">(<\/span>finalMsg<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>\u4e8c\u3001 \u67b6\u6784\u539f\u7406\u89e3\u6790<\/h4>\n<p>\u4e3a\u4ec0\u4e48\u8fd9\u6837\u4fee\u6539\u80fd\u89e3\u51b3\u95ee\u9898&#xff1f;<br \/>\n1. \u72b6\u6001\u7801\u4f18\u5148\u7ea7\u62e6\u622a<br \/>\n\u6211\u4eec\u5728\u4ee3\u7801\u6700\u524d\u7aef\u589e\u52a0\u4e86\u5bf9 502\u3001503 \u7684\u5224\u65ad\u3002\u4e00\u65e6\u68c0\u6d4b\u5230\u8fd9\u4e9b\u72b6\u6001\u7801&#xff0c;\u76f4\u63a5\u8fd4\u56de\u56fa\u5b9a\u7684\u53cb\u597d\u6587\u6848&#xff0c;\u963b\u65ad\u540e\u7eed\u903b\u8f91\u3002\u8fd9\u6837\u907f\u514d\u4e86\u5c06\u8fd9\u4e9b\u9519\u8bef\u4f20\u9012\u5230\u540e\u7eed\u7684\u4e1a\u52a1\u903b\u8f91\u4e2d\u3002<br \/>\n2. \u533a\u5206\u201c\u65e0\u54cd\u5e94\u201d\u4e0e\u201c\u9519\u8bef\u54cd\u5e94\u201d<br \/>\n\u5f53\u670d\u52a1\u5668\u5b8c\u5168\u5173\u95ed&#xff08;\u751a\u81f3\u8fde Nginx \u90fd\u6ca1\u5f00&#xff09;\u65f6&#xff0c;Axios \u6536\u4e0d\u5230 HTTP \u54cd\u5e94&#xff0c;\u6b64\u65f6 error.response \u4e3a undefined\u3002<br \/>\n\u4ee3\u7801\u901a\u8fc7 error.message.includes(&#039;Network Error&#039;) \u51c6\u786e\u6355\u6349\u4e86\u8fd9\u79cd\u5e95\u5c42\u7f51\u7edc\u4e2d\u65ad\u7684\u60c5\u51b5\u3002<br \/>\n3. \u72b6\u6001\u6620\u5c04\u8868<br \/>\n\u901a\u8fc7 statusTextMap \u5bf9\u8c61&#xff0c;\u6211\u4eec\u5c06\u5e38\u89c1\u7684 HTTP \u9519\u8bef\u7801&#xff08;400, 404, 500&#xff09;\u96c6\u4e2d\u7ba1\u7406\u3002\u5982\u679c\u540e\u7aef\u6ca1\u6709\u8fd4\u56de\u8be6\u7ec6\u7684 errorMsg&#xff0c;\u524d\u7aef\u4f1a\u81ea\u52a8\u6839\u636e\u72b6\u6001\u7801\u663e\u793a\u201c\u8bf7\u6c42\u53c2\u6570\u9519\u8bef\u201d\u6216\u201c\u670d\u52a1\u5668\u5185\u90e8\u5f02\u5e38\u201d&#xff0c;\u800c\u4e0d\u662f\u539f\u751f\u7684\u82f1\u6587\u5806\u6808\u4fe1\u606f\u3002<br \/>\n4. \u6d88\u9664\u6280\u672f\u672f\u8bed<br \/>\n\u539f\u6765\u7684 error.message \u53ef\u80fd\u5305\u542b Request failed with status code&#8230; \u8fd9\u79cd\u6280\u672f\u672f\u8bed\u3002\u7ecf\u8fc7\u4e0a\u8ff0\u91cd\u6784&#xff0c;\u7528\u6237\u770b\u5230\u7684\u5c06\u53ea\u6709\u4f60\u5b9a\u4e49\u7684\u4e2d\u6587\u63d0\u793a\u8bed&#xff0c;\u4f53\u9a8c\u66f4\u52a0\u7edf\u4e00\u3002<\/p>\n<h4>\u4e09\u3001 \u6d4b\u8bd5\u5efa\u8bae<\/h4>\n<p>\u4fee\u6539\u5b8c\u6210\u540e&#xff0c;\u5efa\u8bae\u8fdb\u884c\u4ee5\u4e0b\u6d4b\u8bd5\u4ee5\u786e\u4fdd\u903b\u8f91\u751f\u6548&#xff1a;<\/p>\n<li>\u6a21\u62df 502&#xff1a;\u505c\u6389 Spring Boot \u540e\u7aef\u670d\u52a1&#xff0c;\u4f46\u4fdd\u7559 Nginx \u8fd0\u884c\u3002\u6b64\u65f6 Nginx \u627e\u4e0d\u5230\u540e\u7aef\u4f1a\u62a5 502\u3002\u5237\u65b0\u524d\u7aef\u70b9\u51fb\u6309\u94ae&#xff0c;\u5e94\u63d0\u793a\u201c\u670d\u52a1\u5668\u6b63\u5728\u7ef4\u62a4\u6216\u5df2\u5173\u95ed&#xff0c;\u8bf7\u7a0d\u540e\u518d\u8bd5\u201d\u3002<\/li>\n<li>\u6a21\u62df\u7f51\u7edc\u65ad\u5f00&#xff1a;\u76f4\u63a5\u628a\u540e\u7aef\u670d\u52a1\u548c Nginx \u5168\u90e8\u5173\u95ed\u3002\u70b9\u51fb\u6309\u94ae\u5e94\u63d0\u793a\u201c\u65e0\u6cd5\u8fde\u63a5\u5230\u670d\u52a1\u5668&#xff0c;\u8bf7\u68c0\u67e5\u7f51\u7edc\u201d\u3002<\/li>\n<li>\u6e05\u7406\u7f13\u5b58&#xff1a;\u4fee\u6539\u5b8c JS \u6587\u4ef6\u540e&#xff0c;\u8bb0\u5f97\u5728\u6d4f\u89c8\u5668\u5f3a\u5236\u5237\u65b0&#xff08;Ctrl &#043; F5&#xff09;\u6e05\u7406\u7f13\u5b58\u3002<br \/>\n\u901a\u8fc7\u8fd9\u79cd\u5168\u5c40\u5c42\u9762\u7684\u5bb9\u9519\u5904\u7406&#xff0c;\u4f60\u7684\u524d\u7aef\u5e94\u7528\u5728\u9762\u5bf9\u540e\u7aef\u670d\u52a1\u6ce2\u52a8\u65f6&#xff0c;\u5c06\u8868\u73b0\u51fa\u66f4\u9ad8\u7684\u5065\u58ee\u6027\u548c\u4e13\u4e1a\u5ea6\u3002<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u7aef\u67b6\u6784\u5b9e\u6218&#xff1a;\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6&#xff0c;\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef&#xff1f;<br \/>\n\u5728\u5f00\u53d1\u4e0e\u8fd0\u7ef4\u8fc7\u7a0b\u4e2d&#xff0c;\u540e\u7aef\u670d\u52a1\u91cd\u542f\u6216\u5b95\u673a\u662f\u5e38\u6709\u7684\u4e8b\u3002\u6b64\u65f6&#xff0c;Nginx \u4f1a\u5411\u6d4f\u89c8\u5668\u8fd4\u56de 502 Bad Gateway \u72b6\u6001\u7801\u3002<br \/>\n\u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;Axios \u4f1a\u629b\u51fa Request failed with status code 502 \u8fd9\u6837\u7684\u539f\u59cb\u9519\u8bef\u4fe1\u606f\u3002\u8fd9\u5bf9\u666e\u901a\u7528\u6237\u6765\u8bf4\u4e0d\u4ec5\u6666\u6da9\u96be\u61c2&#xff0c;\u8fd8\u5bb9\u6613\u5f15\u8d77\u6050\u614c\u3002\u4f5c\u4e3a\u524d\u7aef\u67b6\u6784\u5e08&amp;#xff0<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[87,43,188],"topic":[],"class_list":["post-102791","post","type-post","status-publish","format-standard","hentry","category-server","tag-87","tag-43","tag-188"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u524d\u7aef\u67b6\u6784\u5b9e\u6218\uff1a\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6\uff0c\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/102791.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u524d\u7aef\u67b6\u6784\u5b9e\u6218\uff1a\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6\uff0c\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u524d\u7aef\u67b6\u6784\u5b9e\u6218&#xff1a;\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6&#xff0c;\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef&#xff1f; \u5728\u5f00\u53d1\u4e0e\u8fd0\u7ef4\u8fc7\u7a0b\u4e2d&#xff0c;\u540e\u7aef\u670d\u52a1\u91cd\u542f\u6216\u5b95\u673a\u662f\u5e38\u6709\u7684\u4e8b\u3002\u6b64\u65f6&#xff0c;Nginx \u4f1a\u5411\u6d4f\u89c8\u5668\u8fd4\u56de 502 Bad Gateway \u72b6\u6001\u7801\u3002 \u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;Axios \u4f1a\u629b\u51fa Request failed with status code 502 \u8fd9\u6837\u7684\u539f\u59cb\u9519\u8bef\u4fe1\u606f\u3002\u8fd9\u5bf9\u666e\u901a\u7528\u6237\u6765\u8bf4\u4e0d\u4ec5\u6666\u6da9\u96be\u61c2&#xff0c;\u8fd8\u5bb9\u6613\u5f15\u8d77\u6050\u614c\u3002\u4f5c\u4e3a\u524d\u7aef\u67b6\u6784\u5e08&amp;#xff0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/102791.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-09T06:17:04+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/102791.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/102791.html\",\"name\":\"\u524d\u7aef\u67b6\u6784\u5b9e\u6218\uff1a\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6\uff0c\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-09T06:17:04+00:00\",\"dateModified\":\"2026-09-09T06:17:04+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/102791.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/102791.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/102791.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u524d\u7aef\u67b6\u6784\u5b9e\u6218\uff1a\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6\uff0c\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef\uff1f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u524d\u7aef\u67b6\u6784\u5b9e\u6218\uff1a\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6\uff0c\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/102791.html","og_locale":"zh_CN","og_type":"article","og_title":"\u524d\u7aef\u67b6\u6784\u5b9e\u6218\uff1a\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6\uff0c\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u524d\u7aef\u67b6\u6784\u5b9e\u6218&#xff1a;\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6&#xff0c;\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef&#xff1f; \u5728\u5f00\u53d1\u4e0e\u8fd0\u7ef4\u8fc7\u7a0b\u4e2d&#xff0c;\u540e\u7aef\u670d\u52a1\u91cd\u542f\u6216\u5b95\u673a\u662f\u5e38\u6709\u7684\u4e8b\u3002\u6b64\u65f6&#xff0c;Nginx \u4f1a\u5411\u6d4f\u89c8\u5668\u8fd4\u56de 502 Bad Gateway \u72b6\u6001\u7801\u3002 \u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;Axios \u4f1a\u629b\u51fa Request failed with status code 502 \u8fd9\u6837\u7684\u539f\u59cb\u9519\u8bef\u4fe1\u606f\u3002\u8fd9\u5bf9\u666e\u901a\u7528\u6237\u6765\u8bf4\u4e0d\u4ec5\u6666\u6da9\u96be\u61c2&#xff0c;\u8fd8\u5bb9\u6613\u5f15\u8d77\u6050\u614c\u3002\u4f5c\u4e3a\u524d\u7aef\u67b6\u6784\u5e08&amp;#xff0","og_url":"https:\/\/www.wsisp.com\/helps\/102791.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-09T06:17:04+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/102791.html","url":"https:\/\/www.wsisp.com\/helps\/102791.html","name":"\u524d\u7aef\u67b6\u6784\u5b9e\u6218\uff1a\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6\uff0c\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-09T06:17:04+00:00","dateModified":"2026-09-09T06:17:04+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/102791.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/102791.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/102791.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u524d\u7aef\u67b6\u6784\u5b9e\u6218\uff1a\u5f53\u670d\u52a1\u5668\u5173\u95ed\u65f6\uff0c\u5982\u4f55\u4f18\u96c5\u63d0\u793a 502 \u9519\u8bef\uff1f"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/102791","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=102791"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/102791\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=102791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=102791"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=102791"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=102791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}