From 30bf95e7b86906653fcab14eeb9f0617ed7fd435 Mon Sep 17 00:00:00 2001 From: Teddy Ortega Date: Wed, 14 Jun 2017 12:45:01 -0700 Subject: [PATCH] Add documentation for devServer.allowedHosts --- content/configuration/dev-server.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/content/configuration/dev-server.md b/content/configuration/dev-server.md index 6636c5886355..da9f21fdb264 100644 --- a/content/configuration/dev-server.md +++ b/content/configuration/dev-server.md @@ -6,6 +6,7 @@ contributors: - skipjack - spacek33z - charlespwd + - orteth01 --- webpack-dev-server can be used to quickly develop an application. See the ["How to Develop?"](/guides/development) to get started. @@ -46,6 +47,34 @@ W> Be aware that when [exporting multiple configurations](/configuration/configu T> If you're having trouble, navigating to the `/webpack-dev-server` route will show where files are served. For example, `http://localhost:9000/webpack-dev-server`. +## `devServer.allowedHosts` + +`array` + +This option allows you to specify a whitelist of hosts that are allowed to access the dev server. + +```js +allowedHosts: [ + 'host.com', + 'subdomain.host.com', + 'subdomain2.host.com', + 'host2.com' +] +``` + +Mimicking django's `ALLOWED_HOSTS`, a value beginning with `.` can be used as a subdomain wildcard. `.host.com` will match `host.com`, `www.host.com`, and any other subdomain of `host.com`. + +```js +// this achieves the same effect as the first example +// with the bonus of not having to update your config +// if new subdomains need to access the dev server +allowedHosts: [ + '.host.com', + 'host2.com' +] +``` + + ## `devServer.clientLogLevel` `string`