Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webpack Dev Server running on HTTPS/Web Sockets Secure

Normally in developer mode Webpack runs using HTTP. There is usually a web server serving content through HTTP and webpack using http/websockets on a separate port.

Is it possible to run the web server on https and webpack on https/websocket secure ?

like image 232
Licx Avatar asked Oct 30 '14 21:10

Licx


2 Answers

See the webpack docs

There is a flag you can add to the webpack-dev-server command

webpack-dev-server --https 
like image 151
royka Avatar answered Nov 08 '22 20:11

royka


While the above answer is correct for cli, if you are not in the CLI, you could do something like this (in a gulp task):

var WebpackDevServer = require('webpack-dev-server');

new WebpackDevServer(webpack(WebpackDevConfig), {
    https: true,
    hot: true,
    watch: true,
    contentBase: path.join(__dirname, 'src'),
    historyApiFallback: true
}).listen(1337, 'localhost', function(err, result) {
    if (err) {
        console.log(err);
    }
    console.log('Dev server running at https://localhost:1337');
});
like image 32
dangoldnj Avatar answered Nov 08 '22 20:11

dangoldnj