Closed phper-chen closed 6 years ago
感觉像是被劫持重定向了,使用secure
参数 请求会走 https 试下
secure参数吗 我用的是STS拿的客户端
行 我查下文档试试 谢谢啊
没用 全部设置 secure:true 依然是这样,结论是你们的api有bug,尽早修复吧
302 这个和 api 没有关系,网络的问题。服务器 dig sensoro-camera.oss-us-west-1.aliyuncs.com 看下你ip指向了哪
你好,命令结果是
; <<>> DiG 9.8.3-P1 <<>> sensoro-camera.oss-us-west-1.aliyuncs.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48219
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;sensoro-camera.oss-us-west-1.aliyuncs.com. IN A
;; ANSWER SECTION:
sensoro-camera.oss-us-west-1.aliyuncs.com. 3600 IN A 47.88.73.66
;; Query time: 5 msec
;; SERVER: 192.168.1.254#53(192.168.1.254)
;; WHEN: Tue Apr 10 19:50:03 2018
;; MSG SIZE rcvd: 75
是美国的阿里云,难道那边的访问不稳定吗
国内往国外请求,本身就会有各种无法预知的网络问题,你把使用 secure:true 后的日志在打下看看。出现这个302的频率大概多少。
基本是请求10次有6-7次是302,频率很高的
查了下日志,4月9日 10点到12点的该object的请求日志都是200状态码,没有302,所以应该是你服务器网络问题。还有日志也查不到最近使用https的记录,把使用 secure:true
出错的日志发下
请问是这个吗?是在鸡蛋框架下开发的
2018-04-11 16:36:37,815 WARN 7000 [-/::1/-/214ms POST /account/login] nodejs.UnknowError: Unknow error, status: 302
at Client.requestError (/Users/coder/Desktop/mydepot/Camera-New-API/node_modules/ali-oss/lib/client.js:455:13)
at requestError.next (<anonymous>)
at Client.request (/Users/coder/Desktop/mydepot/Camera-New-API/node_modules/ali-oss/lib/client.js:311:27)
at request.next (<anonymous>)
at onFulfilled (/Users/coder/Desktop/mydepot/Camera-New-API/node_modules/co/index.js:65:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'UnknowError'
status: 302
requestId: undefined
host: ''
params: { object: 'ota/redis2mysql.zip', bucket: 'xx-xx', method: 'GET', subres: undefined, timeout: undefined, ctx: undefined, customResponse: true, successStatuses: [ 200, 206, 304 ] }
pid: 7000
hostname: localhost
和上面一样的日志,有个header字段 _header: 'GET /ota/redis2mysql.zip HTTP/1.1\r\nx-oss-date: Mon, 09 Apr 2018 11:00:14 GMT\r\nx-oss-user-agent: aliyun-sdk-nodejs/4.11.3 Node.js 8.7.0 on darwin x64\r\nUser-Agent: aliyun-sdk-nodejs/4.11.3 Node.js 8.7.0 on darwin x64\r\nx-oss-security-token: CAIStAJ1q6Ft5B2yfSjIq6zEB/fuo61R47GgZ0P9vW1idblGp4/9ijz2IHFEfXJoA+4WsPw0nmFS7fselqp6U4cdofow1wk0vPpt6gqET9frVaXXhOV2YPTHdEGXDxnkpriwB8zyUNLafNq0dlnAjVUd6LDmdDKkLTPHXJqSkswlFOp1ODO1dj1bHtxbCxJ/ocsBTxvrOO2qLwThjxiCbjhhsREujnhku+btgJ+H5xzFi0f9j+QcoonrK/rQZsJ3bpBkSIX3jq4kbafHyylK7F1B/aJ7lqUDuxW/54vAXAkJskjca7qJrIM2dTUUPPZqR/R2y9HnjuB9t+DpkID69g1AJ+k9UV6EFdD5m5OeRrP3bo1jJOygZijXr9eULdz+ugYpe3teLg5Dd58+MH5sBAznvud/yzhSkhqAASmYIPxPUFBp9a2lRjZoiVVQO1QAVeZw7L6Uh32pgrZN5wIaEIALxL9qmannRb/VH/KkdqqaGfD/JwqI1eGXg+0HoQqGYHx4MMzjkdX2AXQUOJEbHfYsyzj5kMLjsSB+ACZMoTjWlY4pWfR8lYNJvraTZ1161kqEepNaQp5NDH2/\r\nContent-Type: application/zip\r\nauthorization: OSS STS.JoqLMZNrpTsKeeLYm7y6jHJVh:q5YERetAndBq1AY+a61zsEWeoKc=\r\nHost: sensoro-camera.oss-us-west-1.aliyuncs.com\r\nConnection: keep-alive\r\n\r\n',
嗯 最近很忙 回头又测试了下 又没问题了 谢谢了
{ data: null, status: 302, headers: { server: 'HRS/1.4.2', date: 'Mon, 09 Aug 2018 11:08:42 GMT', 'content-length': '0', 'content-type': 'text/html', connection: 'close', 'cache-control': 'no-cache', location: 'http://101.96.8.164/xx-xx.oss-us-west-1.aliyuncs.com/ota/xxx.zip' }, res: IncomingMessage { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [Object], length: 0, pipes: null, pipesCount: 0, flowing: null, ended: true, endEmitted: false, reading: false, sync: true, needReadable: false, emittedReadable: true, readableListening: false, resumeScheduled: false, destroyed: false, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: true, decoder: null, encoding: null }, readable: true, domain: null, _events: { end: [Function: responseOnEnd] }, _eventsCount: 1, _maxListeners: undefined, socket: Socket { connecting: false, _hadError: false, _handle: [Object], _parent: null, _host: 'xx-xx.oss-us-west-1.aliyuncs.com', _readableState: [Object], readable: true, domain: null, _events: [Object], _eventsCount: 9, _maxListeners: undefined, _writableState: [Object], writable: true, allowHalfOpen: false, _bytesDispatched: 1017, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, _idleTimeout: 30000, _idleNext: [Object], _idlePrev: [Object], _idleStart: 649621, _destroyed: false, parser: null, _httpMessage: [Object], read: [Function], _consuming: true, _peername: [Object],
2018-04-09 19:00:14,791 WARN 7826 [-/::1/-/392ms POST /account/login] nodejs.UnknowError: Unknow error, status: 302 at Client.requestError (/Users/coder/Desktop/mydepot/Camera-New-API/node_modules/ali-oss/lib/client.js:456:13) at requestError.next ()
at Client.request (/Users/coder/Desktop/mydepot/Camera-New-API/node_modules/ali-oss/lib/client.js:311:27)
at request.next ()
at onFulfilled (/Users/coder/Desktop/mydepot/Camera-New-API/node_modules/co/index.js:65:19)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'UnknowError'
status: 302
requestId: undefined
host: ''
params: { object: 'ota/xxxx.zip', bucket: 'xxxxx', method: 'GET', subres: undefined, timeout: undefined, ctx: undefined, customResponse: true, successStatuses: [ 200, 206, 304 ] }
pid: 7826
hostname: localhost