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

Invalid Host/Origin header errors showing up in the JS console #488

Closed
wujekbogdan opened this issue Jan 10, 2019 · 4 comments
Closed

Invalid Host/Origin header errors showing up in the JS console #488

wujekbogdan opened this issue Jan 10, 2019 · 4 comments

Comments

@wujekbogdan
Copy link

I use Webpack Encore to build assets for my non-Symfony app. Let's say that the app root URL is http://my-app.dev.

My app has a parser for the manifest.json file so it's able to load assets from http://my-app.dev/dist/ or from http://127.0.0.1:8080/ - depending on the dev/production mode.

The problem is that if the assets are server from Webpack dev server URL (http://127.0.0.1:8080/) then Invalid Host/Origin header errors keep on showing up in the JS console.

The errors are caused by Webpack dev server. Here's the bug report.

invalid host origin header

@quberok
Copy link

quberok commented Jan 20, 2019

Try to run

./node_modules/.bin/encore dev-server --host 0.0.0.0 --disable-host-check

It should help you to resolve the problem

@Lyrkan
Copy link
Collaborator

Lyrkan commented Jan 20, 2019

Hi,

@Quberik From what I read on the webpack-dev-server issue it should have been fixed in 3.1.14.

Since Encore already asks for ^3.1.14 you shouldn't have to use disableHostCheck... which, as its name implies, disables an important security check.

Using it in combination with --host 0.0.0.0 is an even worse idea since it means that anyone/anything will be able to connect to your dev server. Maybe there are some situations where doing it can be needed but you shouldn't unless you don't have any other choice and fully understand what it means.

This issue doesn't seem to be one of those situations and can most likely be solved by doing something like --public my-app.dev:8080 or --host my-app.dev --port 8080.

@wujekbogdan
Copy link
Author

wujekbogdan commented Jan 20, 2019

It should help you to resolve the problem

It's a workaround, not a solution. The solution is to upgrade webpack-dev-server to 3.1.14. The bug is already fixed there: webpack/webpack-dev-server#1608

@Lyrkan
Copy link
Collaborator

Lyrkan commented Feb 23, 2019

Closing this one since it shouldn't be an issue anymore.

@Lyrkan Lyrkan closed this as completed Feb 23, 2019
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

3 participants