nginx 反向代理minio错误排查

错误1

在使用预签名时出现以下错误:


<Error>
    <Code>SignatureDoesNotMatchCode>
    <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.Message>
    <Key>25ddd455-0f47-414c-8f32-40a4f9dab2ad.jpgKey>
    <BucketName>object-imagesBucketName>
    <Resource>/object-images/25ddd455-0f47-414c-8f32-40a4f9dab2ad.jpgResource>
    <RequestId>171DC9F70242E7B9RequestId>
    <HostId>e018e642-71a1-41f3-bd47-e20d6c2ad4f1HostId>
Error>

错误原因:
错误的将MINIO_HOST指定成ip:port,前端上传时使用域名上传就会出现以上错误
正确的方法是签名和上传时应该统一,使用ip:port或域名,不能混用

minio_client = Minio(
    MINIO_HOST,
    access_key=MINIO_ACCESS_KEY,
    secret_key=MINIO_SECRET_KEY,
    secure=MINIO_SECURE
)

错误2

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='xxx.com', port=443): 
Max retries exceeded with url: /object-images?location= (Caused by 
SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))

指定http_client即可

http_client = urllib3.PoolManager(
    timeout=urllib3.util.Timeout(connect=10, read=10),
    maxsize=10,
    cert_reqs='CERT_NONE',
    ca_certs=os.environ.get('SSL_CERT_FILE') or certifi.where(),
    retries=urllib3.Retry(
        total=5,
        backoff_factor=0.2,
        status_forcelist=[500, 502, 503, 504]
    )
)

minio_client = Minio(
    MINIO_HOST,
    access_key=MINIO_ACCESS_KEY,
    secret_key=MINIO_SECRET_KEY,
    http_client=http_client,
    secure=MINIO_SECURE
)

你可能感兴趣的:(python,minio,nginx,运维,minio)