Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to forward http requests to https with webpack?

I have a webpack configuration of an https webserver. When an http request arrives, it just returns ERR_CONNECTION_REFUSED. How can I configure it to forward all http requests to https?

on package.json, the relevant script is:

"start:staging": "webpack-dev-server --config config/webpack.server.stage.config.js --mode production --open --host 0.0.0.0 --port 443",

on webpack.server.config.js:

module.exports = {
...
    devServer: {
        historyApiFallback: true,
        contentBase: '/',
        public: <my domain>,
        https: {
            key: key,
            cert: cert,
            ca: ca
        }  
    }
...

I tried playing with proxy options but couldn't make it to work. Any assistance would be much appreciated.

like image 275
Shirkan Avatar asked Sep 13 '25 19:09

Shirkan


1 Answers

It seems that webpack have issue for this feature. Just linking it for anybody who would come here https://github.com/webpack/webpack-dev-server/issues/126.

like image 75
Petr Přikryl Avatar answered Sep 16 '25 09:09

Petr Přikryl