Open captainjackrana opened 7 years ago
Hi! server.connection
returns a Server
object with just a single connection. You can then do:
const https = server.connection({ port: 443, host: constants.application.host, tls: tls }); // https
const http = server.connection({ port: 80, host: constants.application.host }); //http
https.register(hapiIO);
http.register(hapiIO)
I'm trying to use hapi-io with a HTTPS Hapi server. I have two connections defined so as to be able to redirect all http requests (port 80) to https
server.connection({ port: 443, host: constants.application.host, tls: tls }); // https server.connection({ port: 80, host: constants.application.host }); //http
However, i cant use hapi-io since i get the following error on registering the plugin -
error: hapi-io - multiple connections
This comes from the rule set in https://github.com/sibartlett/hapi-io/blob/master/lib/index.js#L34
if (s.connections.length !== 1) { return next('hapi-io - multiple connections'); }
How do i set it up on my server?