minio预先签署了403的超额结果

时间:2017-02-05 09:35:05

标签: javascript superagent minio

我正在尝试编写一个基本测试,以确保我的minio安装正常工作。我写了一个测试,跟随他们使用presigned POST policy的例子,它工作正常,但我似乎无法创建一个预先签名的PUT的工作示例。我得到了一个403 Forbidden,原因是:

cause="Signature does not match" 
source="[objecthandlers.go:468:objectAPIHandlers.PutObjectHandler()]"

这是测试代码。我已经宣传了minio javascript API并使用磁带作为测试工具。 POST策略的类似代码也可以。

编辑:这是问题根源的重要部分:

var minio = new Minio.Client({
    endPoint: 'minioTest',     // <- the problem
    port: 9000,
    secure: false,
    accessKey: 'DONALDJTRUMP',
    secretKey: 'DONALDJTRUMP'
});

test('should be able to PUT to a presigned URL', function(assert) {

  const filename = 'signedtest2.txt';

  return minio.presignedPutObjectAsync(bucket, filename, 60)
  .then(url => {
    assert.ok(url.length > 200, 'URL is non empty');
    console.log(url);
    return agent
    .put(url)
    .set('Content-Type', 'text/plain')
    .attach('file', 'test/data/test.txt');
  }).then(r => {
    assert.ok(r.ok);
    console.log(JSON.stringify(r, null, 2));
  }).catch(err => {
    assert.fail('got error', err);
    console.log(err);
  });
});

我做错了什么让我成为403 Forbidden?

2 个答案:

答案 0 :(得分:2)

SuperAgent,minio-js或者minio服务器不喜欢在主机名(endPoint)中使用大写字符。唉我正在使用自动分配主机名的docker,因此如果你使用camelCase作为容器名,就允许这样做,我只是剪切并粘贴了容器名。

将此行更改为小写可以解决问题:

endPoint: 'miniotest',     // <- this must be lower case

主机名是case insensitive所以它不应该有问题。我还没有确定它是哪个组件,但是在生成或验证签名时可能会强制小写,因此它们不匹配。

我注意到我没有必要将容器从camelCase更改。

答案 1 :(得分:1)

@paul我们已经解决了这个问题,它已在源代码中修复。请升级。