Webpack-dev-server proxy request api

  node.js, question

Under developmentreactWhen usingwebpackDevelopment,
On requestapiData, cross-domain problems encountered,
Seewebpack-dev-serverYou can proxy requests,

SeeDescription of the official website

proxy: {
 '/some/path*': {
 target: 'https://other-server.example.com',
 secure: false
 bracket
 bracket

So in their ownwebpackAdd in

var webpack = require('webpack');
 var WebpackDevServer = require('webpack-dev-server');
 var config = require('./webpack.config');
 
 new WebpackDevServer(webpack(config), {
 contentBase: './public',
 publicPath: config.output.publicPath,
 hot: true,
 
 proxy: {
 '/ShoppingGuideAPI/*': {
 target: 'http://api.mu.com',
 secure: false,
 bracket
 },
 historyApiFallback: true
 }).listen(3000, 'localhost', function(err, result) {
 if (err) {
 console.log(err);
 bracket
 console.log('Listening at localhost:3000');
 });

Fetch is introduced into react component

import 'whatwg-fetch';
 
 //Get external data after component rendering
 componentDidMount() {
 fetch(api)
 .then((response) => {
 return response.json();
 })
 .then((data) => {
 console.log(data);
 this.setState({
 data: data[0]['description'],
 
 });
 
 console.log(this.state.data);
 })
 .catch((ex) => {
 console.log(ex);
 });
 bracket

Finally, when requesting data, the result returned was 404

I am configured as follows:

devServer: {
 historyApiFallback: true,
 hot: true,
 inline: true,
 contentBase: './build',
 port: 8080,
 stats: { colors: true },
 
 proxy: {
 '/api': {
 target:  'http://user.reekly.com/' ,
 pathRewrite: {'^/api' : '/campaign_huggies/t3store_freeuse/admin'},
 changeOrigin: true
 bracket
 bracket
 },

suchhttp://localhost:8080/api/get …The request for is the back-end interfacehttp://user.reekly.com/campai …The