java程序在调用Minio api报错信息如下
Error occurred: error occurred
ErrorResponse(code=AccessDenied, message=Access denied, bucketName=f3e0a479-60da-45c8-9ac2-5b744a92d419, objectName=null, resource=/f3e0a479-60da-45c8-9ac2-5b744a92d419, requestId=15E37CD9D06980DF, hostId=null)
request={method=HEAD, url=http://125.220.157.228:83/f3e0a479-60da-45c8-9ac2-5b744a92d419, headers=Host: 125.220.157.228:83
User-Agent: MinIO (amd64; amd64) minio-java/dev
x-amz-date: 20191225T023929Z
}
response={code=403, headers=Server: nginx/1.13.6
Date: Wed, 25 Dec 2019 02:39:29 GMT
Content-Length: 0
Connection: keep-alive
Accept-Ranges: bytes
Content-Security-Policy: block-all-mixed-content
Vary: Origin
X-Amz-Request-Id: 15E37CD9D06980DF
X-Xss-Protection: 1; mode=block
}
解决方案:
1. 校验minio部署服务器的时间与程序运维主机时间是否相差太大,尽量保持一致
2. 若Minio服务器使用nginx进行代理,请检查nginx 是否按照如下标准的格式进行配置
server {
listen 80;
server_name example.com; // 主机名
location / {
proxy_set_header Host $http_host;
proxy_pass http://localhost:9000; // 你的Minio服务器地址
}
}