http serve and serveTls using async iterator cannot serve multiple domains
async f_serveTls() {
var o_self = this
// check if ssl cert exists
await o_self.f_check_if_ssl_exists();
await this.f_init();
// var self = this;
var o_server_https = Deno.listenTls(
{
certFile: o_self.o_config.o_ssl.s_path_certificate_file,
keyFile: o_self.o_config.o_ssl.s_path_key_file,
port: o_self.o_config.o_encrypted.n_port,
hostname: o_self.o_config.o_encrypted.s_host,
}
);
o_self.f_handle_connections_and_serve_http2(o_server_https,o_http_request_handler_default);
}
async f_serve() {
var o_self = this;
await this.f_init();
var o_server = Deno.listen(
{
port: parseInt(o_self.o_config.o_not_encrypted.n_port),
hostname: o_self.o_config.o_not_encrypted.s_host,
}
)
o_self.f_handle_connections_and_serve_http2(o_server,o_http_request_handler_default);
// o_self.f_handle_connections_and_serve_http(o_server,o_http_request_handler_file_explorer);
}
async f_handle_connections_and_serve_http2(o_server,o_http_request_handler){
for await (const o_connection of o_server) {
(async () => {
const o_http_connection = Deno.serveHttp(o_connection);
for await (const o_request_event of o_http_connection) {
return await o_http_request_handler.f_http_request_handler(
o_http_connection,
o_request_event,
o_self
)
// ... handle requestEvent ...
}
})();
}
}
async f_serveTls() {
var o_self = this
// check if ssl cert exists
await o_self.f_check_if_ssl_exists();
await this.f_init();
// var self = this;
var o_server_https = Deno.listenTls(
{
certFile: o_self.o_config.o_ssl.s_path_certificate_file,
keyFile: o_self.o_config.o_ssl.s_path_key_file,
port: o_self.o_config.o_encrypted.n_port,
hostname: o_self.o_config.o_encrypted.s_host,
}
);
o_self.f_handle_connections_and_serve_http2(o_server_https,o_http_request_handler_default);
}
async f_serve() {
var o_self = this;
await this.f_init();
var o_server = Deno.listen(
{
port: parseInt(o_self.o_config.o_not_encrypted.n_port),
hostname: o_self.o_config.o_not_encrypted.s_host,
}
)
o_self.f_handle_connections_and_serve_http2(o_server,o_http_request_handler_default);
// o_self.f_handle_connections_and_serve_http(o_server,o_http_request_handler_file_explorer);
}
async f_handle_connections_and_serve_http2(o_server,o_http_request_handler){
for await (const o_connection of o_server) {
(async () => {
const o_http_connection = Deno.serveHttp(o_connection);
for await (const o_request_event of o_http_connection) {
return await o_http_request_handler.f_http_request_handler(
o_http_connection,
o_request_event,
o_self
)
// ... handle requestEvent ...
}
})();
}
}
localhost:8080
or localhost:8443
all works , but then when i want to vist my other domain i get a timeout...
anybody knows how to serve https and http for multiple domains ?0 Replies