Mixed content with webpack-dev-server


Hoping someone has run into this before: I’m trying to run my webpack-devserver on c9 which is working but I’m unable to load my assets because they are being served over http (c9 server is over https). I’ve tried to put the webpack-devserver into https mode using the --https option but then I receive a “unable to proxy request” error.

Here is the console error I’m getting when I preview the page in my dashboard.

Mixed Content: The page at ‘https://bby-metrix-ibuck.c9users.io/?_c9_id=livepreview0&_c9_host=https://ide.c9.io’ was loaded over HTTPS, but requested an insecure script ‘http://localhost:8080/vendor.a26a55c19dbd3bb5e36f.js’. This request has been blocked; the content must be served over HTTPS.

Any help/suggestions would be appreciated!

Getting webpack-dev-server to run in cloud9
Webpack-dev-server + node + c9

It may help to load the content based on relative urls, not by domain.


Thanks. The trick for me is figuring out how to get the webpack-devserver to inject with “//path-to-asset.js” vs using “http or https”. I’ve hard coded the path to the assets for now and turned off auto-hashing. It works but not ideal.


This looks like a bug in https://github.com/webpack/webpack-dev-server/blob/3dd3e2abfe/client/index.js#L65.
If hostname is it correctly replaces it with window.location.hostname but forgets to replace urlParts.protocol

I think replacing https://github.com/webpack/webpack-dev-server/blob/3dd3e2abfe/client/index.js#L63 with

window.location.protocol == "https:" ?  "https:" : urlParts.protocol

should fix the issue


This did help the error to go away but i don’t understand…
url module should give the protocol correctly in both cases… why doesn’t it… any thoughts


webpack serves content to http, but it is behind a proxy that is opened with https url.