@@ -18,55 +18,6 @@ As a consequence, the ``link`` and ``script`` tags need to point to the new serv
18
18
:ref: `processing your assets through entrypoints.json <load-manifest-files >` in some other way),
19
19
you're done: the paths in your templates will automatically point to the dev server.
20
20
21
- Enabling HTTPS using the Symfony Web Server
22
- -------------------------------------------
23
-
24
- If you're using the :doc: `Symfony web server </setup/symfony_server >` locally with HTTPS,
25
- you'll need to also tell the dev-server to use HTTPS. To do this, you can reuse the Symfony web
26
- server SSL certificate:
27
-
28
- .. code-block :: terminal
29
-
30
- # Unix-based systems
31
- $ yarn dev-server --https --pfx=$HOME/.symfony/certs/default.p12
32
-
33
- # Windows
34
- $ encore dev-server --https --pfx=%UserProfile%\.symfony\certs\default.p12
35
-
36
- To avoid repeating yourself, you can also update ``package.json `` to include
37
- these options automatically:
38
-
39
- .. code-block :: diff
40
-
41
- {
42
- ...
43
- "scripts": {
44
- - "dev-server": "encore dev-server",
45
- + "dev-server": "encore dev-server --https --pfx=$HOME/.symfony/certs/default.p12 --allowed-hosts=mydomain.wip",
46
- ...
47
- }
48
- }
49
-
50
- If you experience issues related to CORS (Cross Origin Resource Sharing), add
51
- the ``--firewall false `` and ``--port `` options to the ``dev-server ``
52
- command in the ``package.json `` file:
53
-
54
- .. code-block :: diff
55
-
56
- {
57
- ...
58
- "scripts": {
59
- - "dev-server": "encore dev-server",
60
- + "dev-server": "encore dev-server --port 8080 --firewall false",
61
- ...
62
- }
63
- }
64
-
65
- .. caution ::
66
-
67
- Beware that `it's not recommended to disable host checking `_ in general, but
68
- here it's required to solve the CORS issue.
69
-
70
21
dev-server Options
71
22
------------------
72
23
@@ -100,6 +51,51 @@ method in your ``webpack.config.js`` file:
100
51
101
52
The ``Encore.configureDevServerOptions() `` method was introduced in Encore 0.28.4.
102
53
54
+ Enabling HTTPS using the Symfony Web Server
55
+ -------------------------------------------
56
+
57
+ If you're using the :doc: `Symfony web server </setup/symfony_server >` locally with HTTPS,
58
+ you'll need to also tell the dev-server to use HTTPS. To do this, you can reuse the Symfony web
59
+ server SSL certificate:
60
+
61
+ .. code-block :: javascript
62
+
63
+ // webpack.config.js
64
+ // ...
65
+
66
+ Encore
67
+ // ...
68
+
69
+ .configureDevServerOptions (options => {
70
+ options .https = {
71
+ pfx: ' /path/to/.symfony/certs/default.p12' ,
72
+ }
73
+ })
74
+
75
+ Then make sure you run the ``dev-server `` with the ``--https `` option:
76
+
77
+ .. code-block :: terminal
78
+
79
+ $ yarn encore dev-server --https
80
+
81
+ CORS Issues
82
+ -----------
83
+
84
+ If you experience issues related to CORS (Cross Origin Resource Sharing), set
85
+ the ``firewall `` option:
86
+
87
+ .. code-block :: javascript
88
+
89
+ // webpack.config.js
90
+ // ...
91
+
92
+ Encore
93
+ // ...
94
+
95
+ .configureDevServerOptions (options => {
96
+ options .firewall = false ;
97
+ })
98
+
103
99
Hot Module Replacement HMR
104
100
--------------------------
105
101
@@ -116,4 +112,3 @@ your page. HMR works automatically with CSS (as long as you're using the
116
112
CSS. That is no longer needed.
117
113
118
114
.. _`webpack-dev-server` : https://webpack.js.org/configuration/dev-server/
119
- .. _`it's not recommended to disable host checking` : https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck
0 commit comments