美文网首页
webpack proxy配置项

webpack proxy配置项

作者: PiNgFan826 | 来源:发表于2016-08-30 10:35 被阅读0次
  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配置项

      本文链接:https://www.haomeiwen.com/subject/vspfettx.html