dongyun7571 2018-06-26 22:50
浏览 250

如何在Iris GoLang Framework中为通配符子域设置AutoTLS

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信小程序协议怎么写
    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看