webpack proxy配置项

2016-08-30  本文已影响0人  PiNgFan826
  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'
                }
            }
            
        }
    }
上一篇 下一篇

猜你喜欢

热点阅读