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

No-schema publicPath url no longer works #1025

Closed
tamouse opened this issue Aug 8, 2017 · 3 comments
Closed

No-schema publicPath url no longer works #1025

tamouse opened this issue Aug 8, 2017 · 3 comments

Comments

@tamouse
Copy link

tamouse commented Aug 8, 2017

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

v2.6.1 allowed the use of an anonymous schema for the publicPath setting for the dev server, e.g. //localhost:8080/webpack/. This is not working in v2.7.0.

With v2.7.0, the client is getting the following errors:

2VM16080:1 GET http://localhost:3808//localhost:3808/webpack/sockjs-node/info?t=1502221718607 404 (Not Found)
(anonymous) @ VM16080:1
AbstractXHRObject._start @ abstract-xhr.js?96d9:132
(anonymous) @ abstract-xhr.js?96d9:21
2:1 XMLHttpRequest cannot load http://localhost:3808//localhost:3808/webpack/sockjs-node/info?t=1502221718607. The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://shasta.lvh.me:3000' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

The path is clearly incorrect.

Modifying config.output.publicPath to add the schema, http://localhost:8080/webpack/ does not fix the problem with CORS:

2VM17313:1 GET http://localhost:3808/webpack/sockjs-node/info?t=1502221853716 404 (Not Found)
(anonymous) @ VM17313:1
AbstractXHRObject._start @ VM17382:132
(anonymous) @ VM17382:21
2:1 XMLHttpRequest cannot load http://localhost:3808/webpack/sockjs-node/info?t=1502221853716. The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://shasta.lvh.me:3000' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
2VM17313:1 GET http://localhost:3808/webpack/sockjs-node/info?t=1502221855787 404 (Not Found)
(anonymous) @ VM17313:1
AbstractXHRObject._start @ VM17382:132
(anonymous) @ VM17382:21

The config section is:

config.devServer = {
    port: devServerPort,
    disableHostCheck: true,
    headers: { 'Access-Control-Allow-Origin': '*' }
  };
  config.output.publicPath = '//localhost:' + devServerPort + '/webpack/';
  // Source maps
  config.devtool = 'cheap-module-eval-source-map';

Full config: https://gist.github.com/tamouse/0fe62da01b27e747ecd9a4d0326edc23

If the current behavior is a bug, please provide the steps to reproduce.

Upgrade from v2.6.1 to v2.7.0

What is the expected behavior?

No change between v2.6.1 and v2.7.0

Please mention your webpack and Operating System version.

Webpack: 2.6.1
MacOS: 10.12.6

@renchap
Copy link

renchap commented Aug 8, 2017

Is it working with 2.7.1?

@tamouse
Copy link
Author

tamouse commented Aug 8, 2017

@renchap i'll try it, i didn't see that in the releases

@tamouse
Copy link
Author

tamouse commented Aug 8, 2017

@renchap It is working as expected in v2.7.1, no config changes, thank you

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

2 participants