Closed MarcJo closed 1 year ago
Please read the release post. You attach routes to SNI domains using app.domain(..). You haven't specified any default SSL cert and you haven't attached any route to your "SNIs"
Thanks. Please provide type definition for app.domain(..).
This is working solution (checked with v20.19.0)
const port = 443
SSLApp( {} )
.addServerName( 'page1.com', {
key_file_name : 'page1.com/key.pem',
cert_file_name : 'page1.com/cert.pem',
})
.domain('page1.com')
.get( '/*', ( res, req ) => {
res.end( 'Hello World! 1' )
} )
.addServerName( 'page2.com', {
key_file_name : 'page2.com/key.pem',
cert_file_name : 'page2.com/cert.pem',
} )
.domain('page2.com')
.get( '/*', ( res, req ) => {
res.end( 'Hello World! 2' )
} )
.missingServerName( ( hostname ) => {
console.log( 'Hello! We are missing server name <' + hostname + '>' )
} )
.listen( port, ( token ) => {
if ( token ) {
console.log( 'Listening to port ' + port )
} else {
console.log( 'Failed to listen to port ' + port )
}
} )
This code works with v20.10.0 fails with v20.15.0 and v20.19.0 It's may be caused due to 'Improved SNI support' in uWebSockets v20.18.0 which does not look to be implemented.