Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,8 @@ class Server {
directory: path.join(process.cwd(), "public"),
staticOptions: {},
publicPath: ["/"],
// TODO in the next major release default to `false`: a listing names
// every file in the directory, and `true` should be how one is asked for.
serveIndex: { icons: true },
watch: getWatchOptions(),
});
Expand Down Expand Up @@ -2215,6 +2217,11 @@ class Server {
return;
}

// TODO in the next major release also require the per-run hot token
// here and on open-editor, once it is handed to every client: both act
// on the developer's machine, and `Sec-Fetch-*`/`Origin` are not sent
// over plain `http` to anything but `localhost`. The overlay's request
// to open-editor has to carry it, from webpack-dev-middleware's client.
if (!this.#isSameOriginRequest(req)) {
res.statusCode = 403;
res.end("Cross-Origin request blocked");
Expand Down Expand Up @@ -4300,6 +4307,11 @@ class Server {
* @returns {Promise<void>}
*/
async listen() {
// TODO in the next major release default `host` to "localhost": with no
// `host`, Node listens on every interface, so the server, the sources it
// serves and the internal endpoints are reachable from the whole network
// by default. Reaching it from another machine should take saying so,
// with `host: "0.0.0.0"`, "local-ip" or an address.
const listenOptions = this.options.ipc
? { path: this.options.ipc }
: { host: this.options.host, port: this.options.port };
Expand Down
Loading