vue.js - 如何在 Vue.js 中使用不同的端口和相同的路径设置多个代理
问题描述
所以,我试图弄清楚如何代理到具有不同端口和相同路径的不同服务器。
xxx.vue:
axios.get('/actuator/health/')
.then(response => this.status = response.data.status)
.catch(err => console.log(err.message))
这是我的 config.vue.js :
module.exports = {
devServer: {
proxy: {
'^/actuator/': {
target: 'http://localhost:59400/',
changeOrigin: true,
secure:false,
pathRewrite: {'^/actuator': '/actuator/'},
logLevel: 'debug'
}
}
}
}
我想用相同的路径从端口 8787 获取数据:
http://localhost:8787/actuator/health
我该怎么做?如果我不能改变路径。
解决方案
推荐阅读
- hive - 多个HiveServer2之间HiveMetaData的数据同步机制是什么
- python - 使用 python 雪花连接器从雪花表中获取列标题
- html - 图像不会在 flex-box 拉伸中调整大小
- corda - 序列化失败方向=“反序列化”,corda
- javascript - 在 Intersection Observer 的 options 参数中设置 root 属性会导致奇怪的行为
- flutter - 当我发布 razorpay 方法时,将付款信息发布到 magento 2 api ..我遇到了这个问题
- python - 使用 scapy python 3 在 Windows 10 中进行 ARP 欺骗和数据包嗅探器
- bert-language-model - 如何在 HuggingFace 中获取 Bert 模型的中间层?
- android - 刷新我构建的内核后,Android 卡在启动(在 logcat 中等待服务 '/dev/binder' 上的服务 'media.audio_policy'...)
- node.js - 我正在使用 Draft.js 在 Nodejs、React.js 中创建帖子表单,但出现“markdown”元素或其他内容的类型错误