ExpressJS SSL on one domain only

ExpressJS SSL on one domain only


I’m using ExpressJS. My app is a https server which also contains a vhost.

app.use(express.vhost('', require('./lib/subdomains/api').app));

Because my SSL certificate is for the root domain only, my domain now fails to load the routes it’s been given.

How can I only use SSL on my root domain and not on my other? I need to be able to share the app configuration between the domains, but not the SSL certificate.

Problem courtesy of: James


Doh. I hadn’t changed my NODE_ENV so the vhost was setup incorrectly in the live environment.

Solution courtesy of: James


Leave a Reply

Your email address will not be published. Required fields are marked *