Browse Source

fix:api 重定向

liujing 8 months ago
parent
commit
c4cfd5f0a2
3 changed files with 8 additions and 5 deletions
  1. 1 1
      src/api/service.js
  2. 1 1
      src/utils/requestOther.js
  3. 6 3
      vue.config.js

+ 1 - 1
src/api/service.js

@@ -82,7 +82,7 @@ export function serviceBar(query,app_alias) {
 }
 //9. 接口解析-接口映射RED相关图表
 export function getChartData(data){
-  let url = `/v1/url-mapping/chart?start_time=${data.start_time}&
+  let url = `/api/v1/url-mapping/chart?start_time=${data.start_time}&
   end_time=${data.end_time}&app_alias=${data.app_alias}&type=${data.type}&
   service_name=${data.service_name}&method=${data.method}&route=${data.route}`
   return instance.get(url)

+ 1 - 1
src/utils/requestOther.js

@@ -17,7 +17,7 @@ import qs from 'qs'
 //   timeout: 30000 // request timeout
 // })
 class Request {
-  constructor(baseURL = '/api') {
+  constructor(baseURL = '/re') {
     this.request = axios.create({
       baseURL,
       headers: {

+ 6 - 3
vue.config.js

@@ -41,9 +41,12 @@ module.exports = {
       errors: true
     },
     proxy: {
-      '/api': {
-        target: 'http://observe-server.cestong.com.cn/re',// 目标服务器地址
-        changeOrigin: true// 是否改变源地址
+      '/re': {
+        target: 'http://observe-server.cestong.com.cn',// 目标服务器地址
+        changeOrigin: true, // 是否改变源地址
+        pathRewrite: {
+          '^/re': ''// 重写路径
+        }
       },
       '/app': {
         target: 'http://app.cestong.com.cn',