// webpack.config.js
devServer: {
compress: true,
contentBase: path.join(__dirname, 'dist'),
disableHostCheck: true,
host: '0.0.0.0',
hot: true,
https: Boolean(env && env.SERVER === 'production') && {
ca: fs.readFileSync('/etc/letsencrypt/live/mydomain.com/fullchain.pem'),
cert: fs.readFileSync('/etc/letsencrypt/live/mydomain.com/cert.pem'),
key: fs.readFileSync('/etc/letsencrypt/live/mydomain.com/privkey.pem')
},
port: 3000
}
When accessing my site via https://mydomain.com, it should work (and it does).
When accessing my site via mydomain.com (HTTP), it should route to the HTTPS version.
There is no rerouting
Not sure it is good for DX purpose, why you need this?
Also it is development server, so it is good DX to allow developers use http and https together, so i am closing this issue, maybe be we will revisit it in future, feel free to feedback, thanks
@jakeleventhal Any chance you got this working? I have a Vue app configured this way and it only works with "https://" specified. It would be nice if http can be redirected to https.
@zachzeyuwang
I wasn't able to do this. Instead I used nginx to reroute requests