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

Is it possible to listen on multiple domains? #1

Open
isoos opened this issue Dec 26, 2021 · 4 comments
Open

Is it possible to listen on multiple domains? #1

isoos opened this issue Dec 26, 2021 · 4 comments
Labels
dependent Depends on another bug of another package or SDK enhancement New feature or request

Comments

@isoos
Copy link

isoos commented Dec 26, 2021

I'd like to have a server that listens on port 443 for multiple domains, resolves the certificates separately, and routes the requests in a per-domain basis. Is this supported / planned? Any thoughts on how I contribute to this package (what design decisions would you prefer)?

@gmpassos
Copy link
Owner

Hi,

I was trying to allow multiple domains for the same server socket with shelf and HttpServer. I did that in Java for another project and worked very well, but I can't find a way to make a Dart HttpServer.bindSecure (https://api.dart.dev/stable/2.15.1/dart-io/HttpServer/bindSecure.html) to be able to load the correct certificate for multiple domains.

If you can help to find a way to build the SecureContext (https://api.dart.dev/stable/2.15.1/dart-io/SecurityContext-class.html) in the correct way to work with multiple domains certificates I can release a new version with this feature. This is the current bottleneck/wall.

What I need now is a working example (@ GitHub), using simple shelf or just HttpServer, that is able to resolve the multiple domain certificates issue.

Thanks to collaborate,
Best regards.

@gmpassos gmpassos added the enhancement New feature or request label Dec 26, 2021
@isoos
Copy link
Author

isoos commented Dec 27, 2021

Oh, I wasn't aware of the limitation of SecureContext. I haven't looked into it much yet, but it seem that it would be worth to file an issue for it in the sdk. Maybe we'll need a new API that supports SNI (server name indication) via e.g. a callback that creates the SecureContext object instead of providing it at the startup.

@gmpassos
Copy link
Owner

In Java there's a method that you can implement to select the certificate from the "key store", what opens the opportunity to select the correct one for the current socket domain. Note that in a secure socket it knows the domain for the certificate due the secure handshake, before any client data is sent.

@gmpassos
Copy link
Owner

gmpassos commented Jan 24, 2022

This issue dependents on:
dart-lang/sdk#36933

@gmpassos gmpassos added the dependent Depends on another bug of another package or SDK label Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependent Depends on another bug of another package or SDK enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants