Skip to content

Commit a1fb993

Browse files
committed
minor #15090 Encore: Update 'Fix "Invalid Host header" Issue'. (marcstraube)
This PR was submitted for the 5.4 branch but it was merged into the 4.4 branch instead. Discussion ---------- Encore: Update 'Fix "Invalid Host header" Issue'. Replace deprecated dev-server option "--disable-host-check" with current config. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases 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 `5.x` for features of unreleased versions). --> Commits ------- 15df424 Encore: Update 'Fix "Invalid Host header" Issue'. Replace deprecated dev-server option "--disable-host-check" with current config.
2 parents 3c3fc1d + 15df424 commit a1fb993

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

frontend/encore/virtual-machine.rst

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,26 +96,27 @@ Fix "Invalid Host header" Issue
9696
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9797

9898
Webpack will respond ``Invalid Host header`` when trying to access files from
99-
the dev-server. To fix this, add the argument ``--disable-host-check``:
99+
the dev-server. To fix this, set the ``firewall`` option:
100100

101-
.. code-block:: diff
101+
.. code-block:: javascript
102102
103-
{
104-
...
105-
"scripts": {
106-
- "dev-server": "encore dev-server --public http://app.vm:8080 --host 0.0.0.0",
107-
+ "dev-server": "encore dev-server --public http://app.vm:8080 --host 0.0.0.0 --disable-host-check",
108-
...
109-
}
110-
}
103+
// webpack.config.js
104+
// ...
105+
106+
Encore
107+
// ...
108+
109+
.configureDevServerOptions(options => {
110+
options.firewall = false;
111+
})
111112
112113
.. caution::
113114

114-
Beware that `it's not recommended to disable host checking`_ in general, but
115+
Beware that `it's not recommended to disable the firewall`_ in general, but
115116
here it's required to solve the issue when using Encore in a virtual machine.
116117

117118
.. _`VirtualBox`: https://www.virtualbox.org/
118119
.. _`VMWare`: https://www.vmware.com
119120
.. _`NFS`: https://en.wikipedia.org/wiki/Network_File_System
120121
.. _`polling`: https://webpack.js.org/configuration/watch/#watchoptionspoll
121-
.. _`it's not recommended to disable host checking`: https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck
122+
.. _`it's not recommended to disable the firewall`: https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck

0 commit comments

Comments
 (0)