webpack-dev-server icon indicating copy to clipboard operation
webpack-dev-server copied to clipboard

fix: use correct port for https reverse proxy

Open qswinson opened this issue 3 years ago • 3 comments

  • [x] This is a bugfix
  • [ ] This is a feature
  • [ ] This is a code refactor
  • [ ] This is a test update
  • [ ] This is a docs update
  • [ ] This is a metadata update

For Bugs and Features; did you add new tests?

New test cases have been added

Motivation / Use-Case

This solves https://github.com/webpack/webpack-dev-server/issues/4292 where the port of the webpack dev server is used instead of the port from the location in https situations.

Breaking Changes

no breaking changes

Additional Info

qswinson avatar Feb 16 '22 20:02 qswinson

CLA Signed

The committers are authorized under a signed CLA.

  • :white_check_mark: Quenby Mitchell (23dc6f4afe261bb28489969e30a2f96e800ae727)

It is breaking change and breaks URLs for local development

Can you provide a test case for the test suite that you say is breaking so I can address it? All of the unit tests are passing. The current behavior is a breaking change from Webpack v4 and is preventing us from upgrading.

qswinson avatar Feb 17 '22 14:02 qswinson

Because you fix it only for 0.0.0.0/etc, it is not valid fix, also other developers can use different ports for proxy, we don't know your proxied port and can't rely on location port (even more it is security problem), you can set https://webpack.js.org/configuration/dev-server/#websocketurl, in your case you can set port: 0, it will be auto - https://github.com/webpack/webpack-dev-server/blob/23dc6f4afe261bb28489969e30a2f96e800ae727/client-src/utils/createSocketURL.js#L143, i.e. what you want

alexander-akait avatar Feb 17 '22 14:02 alexander-akait