国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

node.js - WeChat applet background apache reverse proxy nodejs, when uploading invalid files, returns an error response?
高洛峰
高洛峰 2017-05-16 13:26:14
0
1
1075

WeChat development tools return to normal

{ code: 2, msg: 'Invalid file' }

WeChat client returns

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 framework

koa-multer middleware, processing uploaded files

When the file is too large or has the wrong type, an error is thrown

Error handling middleware

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教學經(jīng)驗。曾任多家上市公司技術總監(jiān)、架構師、項目經(jīng)理、高級軟件工程師等職務。 網(wǎng)絡人氣名人講師,...

reply all(1)
洪濤

I found the reason, it is related to pm2. It restarts as soon as an error is thrown, and catch is useless. WeChat development tools and clients, and network processing should be different

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template