iview / iview-cli

Create an iView project in visual way
https://iviewui.com/cli
MIT License
727 stars 149 forks source link

iview-cli 在webpack.dev.config.js 里的devServer配置代理跨域不生效 #37

Open anotherLee opened 6 years ago

anotherLee commented 6 years ago
devServer:{
        historyApiFallback: true,
        hot: true,
        inline: true,
        proxy:{
            '/api': {
                target: 'http://example.com:8080',
                secure: false,
                changeOrigin: true,
                pathRewrite:{
                    '^/api':'/api'
                }
            }
        }
    }

如此配置之后依然无法转发和跨域,参考了goole到的几篇文章,似乎都是这样配的。 参考地址1:https://segmentfault.com/q/1010000011222653 参考地址2:https://hk.saowen.com/a/1bfaaf0ee2020d8736982c9214aeffb83e1fac39b84eacac46388775de49cb38