Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(dev-server.md): Clarify the possible return value for devServer.… #3211

Merged
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