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

[FEATURE REQUEST]Muti-Domains TLS Support #1690

Open
Little-YangYang opened this issue Dec 14, 2020 · 5 comments
Open

[FEATURE REQUEST]Muti-Domains TLS Support #1690

Little-YangYang opened this issue Dec 14, 2020 · 5 comments
Assignees

Comments

@Little-YangYang
Copy link

Is your feature request related to a problem? Please describe.
I want use muti-domains bind to port 443 and use domain to defined the api service endpoint, in one domain like "domain.com" I can use wildcard cert to make subdomain support, however, I can not use muti-domain for TLS support.
Yes, maybe looked like a TLS supported virtualhost, or a gateway-like service.
For example:

First, I want use iris to build my blog use domain1.com, this will taken my 80 and 443 ports left.

Second, I want build another website in same server to show my product in domain domain2.com.

If I want users can access my product website easily, I should reuse ports 80, 443, whatever, I don't think start a new iris service in other ports is a good idea, because user do not like type ports in domain normally.

Describe the solution you'd like
Support muti-domain TLS in one iris application.

Describe alternatives you've considered

  • Make Nginx or Apache to be an agent support tls virtual host and proxy to service api.
  • Use SNI to defined which domain accessed and return target domain certificate and make connection.
  • Listen 80 and 443 in one iris application, then check host and redirect to target domain defined service with other ports(running other iris application).

Additional context
Nil

@kataras
Copy link
Owner

kataras commented Dec 14, 2020

Hello @Little-YangYang, I think it's better to use Nginx or Caddy for that scenarios but if you just want two Iris application running under the same process with two different subdomains/domains on the same host:port, you may want to check out the apps package or/and the rewrite middleware. Waiting for your response.

@Little-YangYang
Copy link
Author

Hello @kataras , thank you for your reply, if I use apps , is there any method to defined tls certificate for each application alone?

@kataras
Copy link
Owner

kataras commented Jan 23, 2021

But you wanted one certificate for all domains, right? If not, TLS certificates can only be registered per listener, there is an alternative of constructing a custom GetCertificate function and choose what to use dynamically.

@Little-YangYang
Copy link
Author

Happy Chinese new year!
Sorry for reply so late. I just come back from my Spring Festival holiday.

There is a scene.


I build a SaaS service website (1.1.1.1) .

User can let there own domain direct to my website.

Beside, these changes are dynamic adding for my SaaS service.

User bought my SaaS service (Maybe a tunnel transfer proxy service or a virtualhost).

User make an A record ( a.userowndomain.com ) to my SaaS service ip 1.1.1.1

User upload own domain certificate ( a.userowndomain.com ) in admin area.

User can access my service over https://a.userowndomain.com

Now I should make a TLS support to a.userowndomain.com (single domain)

Can I make a map[hostname] certificate to store certificate which user uploaded, then use custom GetCertificate function to dynamic return TLS certificate?

@zyxgad
Copy link

zyxgad commented Sep 19, 2021

I think you can use app.Shutdown(ctx) shutdown server first, and then you can use app.Run(iris.TLS(userkcmap[username].key, userckmap[username].cer)) restart it

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

No branches or pull requests

3 participants