devServer.proxy
: object
Proxying some URLs can be useful when you have a separate API backend development server and you want to send API requests on the same domain.
The dev-server makes use of the powerful http-proxy-middleware
package.
With a backend on localhost:3000
, you can use this to enable proxying:
1 | proxy: { |
A request to /api/users
will now proxy to the request to http://localhost:3000/api/users
If you don’t want /api
to be passed along, we need to rewrite the path
1 | proxy: { |
A backend server running on HTTPS with an invalid certificate will not be accepted by default. If you want to, modify config like this:
1 | proxy: { |