Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol option is overwrited. #2083

Closed
1 of 2 tasks
Ne3l opened this issue Jul 1, 2019 · 5 comments
Closed
1 of 2 tasks

Protocol option is overwrited. #2083

Ne3l opened this issue Jul 1, 2019 · 5 comments

Comments

@Ne3l
Copy link

Ne3l commented Jul 1, 2019

  • Operating System: MacOs 10.14.2

  • Node Version: 10.15.1

  • NPM Version: 6.9.2

  • webpack Version: 4.35.2

  • webpack-dev-server Version: 3.7.2

  • This is a bug

  • This is a modification request

Code

// webpack.config.js
module.exports ={
  ...moreSettings
  entry: [
      isDevEnv && `${require.resolve('webpack-dev-server/client')}`,
      isDevEnv && require.resolve('react-dev-utils/webpackHotDevClient'),
      entryPoint,
    ].filter(Boolean),
   ...moreSettings
}
// additional code, remove if not needed.
// webpack-dev-server config

module.exports = {
  hot: true,
  inline: true,
  watchOptions: {
    ignored: /node_modules/,
    aggregateTimeout: 300,
    poll: 500,
  },
  publicPath: '/',
  quiet: true,
  https: false,
};

Expected Behavior

Webpack-dev-server respects http protocol.

Actual Behavior

Webpack-dev-server overwrites the http protocol with htttps

For Bugs; How can we reproduce the behavior?

In our case we inject the bundle from http://localhost:3000 inside https://www.domain.com that it's mapped to our docker php application. When doing this the socket-js points to https://localhost:3000 instead of http://localhost:3000.

This line seems responsible for this ->

(self.location.protocol === 'https:' || urlParts.hostname === '0.0.0.0')

For Features; What is the motivation and/or use-case for the feature?

@alexander-akait
Copy link
Member

alexander-akait commented Jul 1, 2019

You should not use webpack-dev-server/client, webpack-dev-server insert this by default and automatically with required options for valid usage

@alexander-akait
Copy link
Member

Anyway please create minimum reproducible test repo with example

@bioPorco
Copy link

Hi,
I have the same problem.
For me it's impossible to provide any test case because architecture is a little bit complicated. I have a system composed by 2 webapps. The first webapp is in charge to mantein the user session, the second expose REST Services for a React App.
Generally the two webapp are in the same jBoss and there is no problem, but for develpment purpose we want to use the first webapp in TEST enviroment and the second webapp in local jBoss.

So basically I am in the same situation of @Ne3l where I inject the bundle from http://localhost:8085 inside a page loaded from https://domain.com. I have resolved all the CORS (Cross-Origin Resource Sharing) and Content-Security-Policy problems but HMR (Hot Module Replacement) still point to https://localhost:8085.

Is there a configuration that explicity set the protocol to use for HMR? Or the only way is to enable https support for dev server (devserverhttps) and handling the complexity introduced by the security layer?

@bioPorco
Copy link

Ok it seems that the problem is addressed here

@shynekomaid
Copy link

Overwrote not overwrited!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants