2019-6-13qiniu

Jun 13, 2019

找到原因:我去找了下我的lookup

1
2
3
4
5
6
7
loopup = (req:Request) => {
let ref
if (req.user) {
ref = req.user._id
}
return [req.path, ref || req.get("X-Real-IP") || req.get("X-Forward-For") || req.ip]
}

原因就在于每次我登进去,key 都不同,与此同时,我不退出,继续使用该api,key 还是不同。

解决方案:由于该route 是public 的,

1
2
3
4
5
6
7
8
9
10
11
lookup = (req:Request) => {
const key = `${req.method}:${req.path}`
if (routesMap[key].accessLevel.level === 'public') {
return [req.path, req.get("X-Real-IP") || req.get('X-Forwarded-For') || req.ip]
}
let ref
if (req.user) {
ref= req.user._id
}
return [req.path, ref || req.get("X-Real-IP") || req.get('X-Forwarded-For') || req.ip]
}

解决qiniu 上传文件>1G code=413

qiniu v=6.0.9

根据github issue提到,fixed in v7.0.2

更新之后,接口也相应更新,然后同时需要在new qiniu.rs.PutPolicy(options) 的options 设置fsizeLimit,

options = { scope: ${bucket}:key, fsizeLimit: 10*1024*1024*1024 } 这样便成功解决上传文件限制大小的问题。