-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Instructions to prevent CORS for Hot Module Replacement #12035
Conversation
Hey! Can you open a new PR? It looks like something got messed up here :/. |
@weaverryan I changed the base branch to Can you please review the PR? Thank you 😃 |
@weaverryan: Yes, I originally made it to the 4.3 branch, but later moved it to 4.2. That gave the errors, sorry. I saw later that in 4.0 and 4.1 there was documentation on the --disable-host-check option, but removed in 4.2. I took me quite some time to figure this out. You need the this --disable-host-check in case the dev-server and your domain/ip are different. Additionally, you need the --port option, but this might also be related to an issue, see symfony/webpack-encore#565. |
@Kocal could you please review this proposed change? Thanks! |
Yes of course, I'm working on it :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add a warning about --disable-host-check
usage?
I remember we already did this for Webpack Encore usage in a virtual machine (https://github.com/symfony/symfony-docs/blob/master/frontend/encore/virtual-machine.rst#fix-invalid-host-header-issue)
@@ -39,5 +39,24 @@ option: | |||
HMR currently works for :doc:`Vue.js </frontend/encore/vuejs>`, but does *not* work | |||
for styles anywhere at this time. | |||
|
|||
For Hot Module Replacement, CORS-errors can appear (Cross Origin Resource Sharing). To handle this, add the --disable-host-check and --port options to your command: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Hot Module Replacement, CORS-errors can appear (Cross Origin Resource Sharing). To handle this, add the --disable-host-check and --port options to your command: | |
For Hot Module Replacement, CORS-errors can appear (Cross Origin Resource Sharing). To handle this, add the ``--disable-host-check`` and ``--port`` options to your command: |
What about this?
|
||
$ yarn encore dev-server --port 8080 --disable-host-check --hot | ||
|
||
Or, alternatively, you can add the options to your package.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, alternatively, you can add the options to your package.json | |
Or, alternatively, you can add the options to your package.json: |
dac881b
to
a68e133
Compare
…(lambertbeekhuis) This PR was submitted for the 4.3 branch but it was merged into the 3.4 branch instead (closes #12035). Discussion ---------- Instructions to prevent CORS for Hot Module Replacement <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- a68e133 Adding instructions to prevent CORS errors
@lambertbeekhuis thanks for your contribution! @Kocal thanks for your review! I did the proposed changes while merging. |
No description provided.