先介绍下我的环境
是用docker跑的minio单节点
外部请求通过nginx进来
然后用s3客户端请求时会出现这个错误

The request signature we calculated does not match the signature you provided. Check your key and signing method. (Service: Amazon S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: 168CA9750BE6D890; S3 Extended Request ID: 2cce05c1-5205-4cbe-bd1b-334f32bddcdf; Proxy: null)

发现这位老哥通过直接开放minio容器的端口解决了这个问题:
https://github.com/minio/minio-js/issues/794

那可能是跟nginx的配置有关系,因为直接启动minio去访问是正常的

那加上请求头里的host试试

proxy_set_header Host $http_host;

    location / {
       proxy_pass http://minio:9000;
       proxy_set_header Host $http_host;
       proxy_connect_timeout 15s;
       proxy_send_timeout 15s;
       proxy_read_timeout 15s;
       proxy_set_header X-Forwarded-Proto http;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

重启下nginx发现恢复正常

问题解决

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐