webpack proxy配置项

  devServer: {
        hot: true,
        inline: true,
        proxy: {
            '/api/*': {
                target: 'http://api.example.com', // target host
                changeOrigin: true,               // needed for virtual hosted sites
                ws: true,                         // proxy websockets
                router: {
                    // when request.headers.host == localhost:3000',
                    // override target 'http://api.example.com' to 'http://localhost:8000'
                    'localhost:3000' : http://api.example.com'
                }
            }
            
        }
    }

你可能感兴趣的:(webpack proxy配置项)