Webpack

The build system for Lore

Configuring SSL

Webpack is configured to serve the application over http as the default. That's what happens when you start the application using this command:

npm start

If you want to serve the application over https, then you need to enable https, specify the host, and provide an SSL certificate and key. You can do that by using this command to start the development server:

npm start --
  --env.https
  --env.host=subdomain.example.com
  --env.cert=/etc/letsencrypt/live/subdomain.example.com/fullchain.pem
  --env.key=/etc/letsencrypt/live/subdomain.example.com/key.pem

The command above would cause the development server to be served on port 3001 instead.

Relevant Section

This section of the Webpack config that controls this behavior is shown below:

devServer: {
  https: env.https || false,
  host: env.host || 'localhost',
  key: env.key ? fs.readFileSync(env.key) : '',
  cert: env.cert ? fs.readFileSync(env.cert) : '',
}