Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 with custom endpoint #2043

1 task done
yu-re-ka opened this issue Oct 25, 2023 · 3 comments
1 task done

S3 with custom endpoint #2043

yu-re-ka opened this issue Oct 25, 2023 · 3 comments


Copy link


  • Yes, I've searched similar issues on GitHub and didn't find any.

How do you use lego?


Detailed Description

#1970 added S3 support for HTTP domain validation, but this is AWS s3 exclusive, as lego does not expose a way to specify a custom s3 endpoint.

Yes, I have a patch locally:

File: ../nixfiles/pkgs/lego.diff
diff --git a/providers/http/s3/s3.go b/providers/http/s3/s3.go
index d8fc4246..84bf3c46 100644
--- a/providers/http/s3/s3.go
+++ b/providers/http/s3/s3.go
@@ -5,6 +5,7 @@ import (
+   "os"
@@ -33,7 +34,11 @@ func NewHTTPProvider(bucket string) (*HTTPProvider, error) {
        return nil, fmt.Errorf("s3: unable to create AWS config: %w", err)
-   client := s3.NewFromConfig(cfg)
+   client := s3.NewFromConfig(cfg, func(o *s3.Options) {
+       o.EndpointResolver = s3.EndpointResolverFromURL(os.Getenv("AWS_ENDPOINT_URL"), func (e *aws.Endpoint) {
+           e.HostnameImmutable = true
+       })
+   })
    return &HTTPProvider{
        bucket: bucket,
Copy link

ldez commented Oct 25, 2023


I think you can open PR based on your suggestion.

Copy link

ldez commented Jan 12, 2024

@yu-re-ka any news?

Copy link

Hi, I don't think the patch I made is universal enough to be useful. There is many options that the user might need to set, like HostnameImmutable, and I don't know how to integrate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

No branches or pull requests

2 participants