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

Instructions to prevent CORS for Hot Module Replacement #12035

Merged
merged 1 commit into from
Sep 26, 2019

Conversation

lambertbeekhuis
Copy link
Contributor

No description provided.

@weaverryan
Copy link
Member

Hey! Can you open a new PR? It looks like something got messed up here :/.

@OskarStark OskarStark changed the base branch from 4.2 to 4.3 July 28, 2019 07:12
@OskarStark
Copy link
Contributor

OskarStark commented Jul 28, 2019

@weaverryan I changed the base branch to 4.3 and from now on 4.2 is EOM. So everything is correct 👍

Can you please review the PR? Thank you 😃

@OskarStark OskarStark added this to the 4.3 milestone Jul 28, 2019
@lambertbeekhuis
Copy link
Contributor Author

@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.

@OskarStark OskarStark requested a review from weaverryan August 12, 2019 06:44
@javiereguiluz
Copy link
Member

@Kocal could you please review this proposed change? Thanks!

@Kocal
Copy link
Member

Kocal commented Sep 20, 2019

Yes of course, I'm working on it :)

Copy link
Member

@Kocal Kocal left a 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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Or, alternatively, you can add the options to your package.json
Or, alternatively, you can add the options to your package.json:

@javiereguiluz javiereguiluz changed the base branch from 4.3 to 3.4 September 26, 2019 13:33
javiereguiluz added a commit that referenced this pull request Sep 26, 2019
…(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
@javiereguiluz javiereguiluz merged commit a68e133 into symfony:3.4 Sep 26, 2019
@javiereguiluz
Copy link
Member

@lambertbeekhuis thanks for your contribution!

@Kocal thanks for your review! I did the proposed changes while merging.

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

Successfully merging this pull request may close these issues.

6 participants