Usage of * (star) as the wildcard is not working:
app.Run(iris.AutoTLS(":443", "*.example.com", "mail@example.com"))
Case of entering subdomains manual is working:
app.Run(iris.AutoTLS(":443", "sub1.example.com sub2.example.com sub3.example.com", "mail@example.com"))
There are a lot of subdomains and it should not be manually controlled. Also if put every subdomain in the list it will be huge and it will not work as of letsencrypt limitations.
Followed this example for wildcard subdomains method: https://github.com/kataras/iris/blob/master/_examples/subdomains/wildcard/main.go
If subdomains are deleted and if there is cert file on host subdomain will work although it is not listed whitelist field.
app.Run(iris.AutoTLS(":443", "sub3.example.com", "mail@example.com"))
So I am presuming autocert function should be executed for each subdomain when visited.
func dynamicSubdomainHandler(ctx iris.Context) { username := ctx.Subdomain() ctx.Writef("Hello from dynamic subdomain path: %s, here you can handle the route for dynamic subdomains, handle the user: %s", ctx.Path(), username) XXX autocert( "username.example.com", "mail@example.com")) XXX }
EDIT: Limitations of letsencrypt are 20 certificates per registered domain per week, but it allows combining up to 100 Names into a single certificate.
So, the idea described above is not a right solution as this should be a new function with a counter. That function then should fill one certificate with subdomains until reach 100 and that request a new certificate which will be filed until 100 and so on. In that way, we can get 2000 subdomains per week, 100 names by 20 certificates per week. This should be implemented in Iris as there are AutoTLS and Wildcard subdomains but they are not working together. Wildcards are not wildcards if you need to set value anywhere.