x509: certificate is valid for *<rest-of-hostname>, not <bucket/hostname>

Viewed 413

I am trying to upload a file to Amazon S3 bucket with Go SDK to a custom endpoint, but I am obtaining that error:

RequestError: send request failed caused by: Put https://<bucket>.<custom-endpoint>/sample.tar.gz: x509: certificate is valid  for *<hostname>, not <bucket/hostname>

The certificate of the custom endpoint contains a wildcard at the beginning of the Common Name (*.), where I should infer that the wildcard would cover the request it is trying to perform.

I have tried to upload the file with Python3 and boto3 package, obtaining a successfull result.

Can you please advise about this?

1 Answers

You could simply put the word "bucket" in front of the vpc endpoint. So, if your endpoint is:

*.vpce-09f99bc99983c51-188851c5.s3.us-east-1.vpce.amazonaws.com

in your config (for the EndpointResolver) you should use:

https://bucket.vpce-09f99bc99983c51-188851c5.s3.us-east-1.vpce.amazonaws.com

Don't forget to to set URL, SigningRegion and Source when returning the EndpointResolverFunc

Related