Skip to content

Commit

Permalink
docs(dev-server.md): Clarify the possible return value for devServer.… (
Browse files Browse the repository at this point in the history
  • Loading branch information
randing89 authored and EugeneHlushko committed Aug 13, 2019
1 parent cbed590 commit 42b249f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/content/configuration/dev-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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__
Expand Down

0 comments on commit 42b249f

Please sign in to comment.