微信開發(fā)工具回傳正常
{ code: 2, msg: '無效的檔案' }
微信客戶端回傳
Bad Gateway! The proxy server received an invalid response from an
upstream server.
apache
httpd-ssl.conf
<VirtualHost _default_:443>
ProxyPass /mina http://127.0.0.1:3000
ProxyPassReverse /mina http://127.0.0.1:3000
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
</VirtualHost>
node
#koa 框架
koa-multer 中間件,處理上傳檔案
當(dāng)檔案過大或類型錯誤時,拋出錯誤
#處理錯誤中間件
async function errorHandler (ctx, next) {
try {
await next()
}
catch (err) {
let msg = parseError(err)
ctx.body = { code: 2, msg }
ctx.type = 'application/json'
}
}
擁有18年軟件開發(fā)和IT教學(xué)經(jīng)驗。曾任多家上市公司技術(shù)總監(jiān)、架構(gòu)師、項目經(jīng)理、高級軟件工程師等職務(wù)。 網(wǎng)絡(luò)人氣名人講師,...
找到原因了,是pm2的關(guān)係,一拋錯誤就重啟,catch也沒用,微信開發(fā)工具和客戶端,網(wǎng)絡(luò)處理應(yīng)該不一樣