vue配置Proxy

vue解决跨域问题

  • 跨域问题

跨域

  • 如何解决

module.exports = {
	devServer: {
		proxy: {
			// 代理
			"/api": {
				target: 'https://api.aboutnb.com',
				changeOrigin: true,
				//  是否为HTTPS协议:true&false
				secure: true,
				//路由重写 转发规则
				pathRewrite: {
					"^/api": ""
				}
			}
		}
	}
}

posted @   _XiaoBo  阅读(111)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示