From 42b249f9cffa516660d190c4a08230f54678b1a5 Mon Sep 17 00:00:00 2001 From: Ran <640557+randing89@users.noreply.github.com> Date: Tue, 13 Aug 2019 06:03:35 -0700 Subject: [PATCH] =?UTF-8?q?docs(dev-server.md):=20Clarify=20the=20possible?= =?UTF-8?q?=20return=20value=20for=20devServer.=E2=80=A6=20(#3211)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/content/configuration/dev-server.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/content/configuration/dev-server.md b/src/content/configuration/dev-server.md index bfb64fd44de6..b2856704132a 100644 --- a/src/content/configuration/dev-server.md +++ b/src/content/configuration/dev-server.md @@ -993,7 +993,11 @@ module.exports = { Sometimes you don't want to proxy everything. It is possible to bypass the proxy based on the return value of a function. -In the function you get access to the request, response and proxy options. It must return either `false` or a path that will be served instead of continuing to proxy the request. +In the function you get access to the request, response and proxy options. + +- Return `null` or `undefined` to continue processing the request with proxy. +- Return `false` to produce a 404 error for the request. +- Return a path to serve from, instead of continuing to proxy the request. E.g. for a browser request, you want to serve a HTML page, but for an API request you want to proxy it. You could do something like this: @@ -1132,7 +1136,7 @@ module.exports = { The bundle will now be available as `http://localhost:8080/assets/bundle.js`. T> Make sure `devServer.publicPath` always starts and ends with a forward slash. - + It is also possible to use a full URL. __webpack.config.js__