From 70b8e62bf99c8089fe738f6516d841c837d8adb8 Mon Sep 17 00:00:00 2001 From: "StarsL.cn" Date: Sun, 17 Jul 2022 23:14:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9Enginx=E8=B0=83=E8=AF=95=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flask-consul/manager.py | 3 +++ vue-consul/src/utils/request-ops.js | 2 ++ vue-consul/vue.config.js | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/flask-consul/manager.py b/flask-consul/manager.py index 1db8333..96d5d8e 100755 --- a/flask-consul/manager.py +++ b/flask-consul/manager.py @@ -13,6 +13,9 @@ from units.avd import avd_list from units.jms import sync_jms app = Flask(__name__) +#非nginx调试,解决跨域CORS问题 +#CORS(app, supports_credentials=True) + app.register_blueprint(login.blueprint) app.register_blueprint(blackbox.blueprint) app.register_blueprint(consul.blueprint) diff --git a/vue-consul/src/utils/request-ops.js b/vue-consul/src/utils/request-ops.js index 7e8dace..3ef8ec6 100644 --- a/vue-consul/src/utils/request-ops.js +++ b/vue-consul/src/utils/request-ops.js @@ -8,6 +8,8 @@ const service = axios.create({ // baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url // withCredentials: true, // send cookies when cross-domain requests baseURL: '', + // 非nginx调试,填写后端的信息。 + // baseURL: 'http://192.168.1.120:2026', timeout: 10000 // request timeout }) diff --git a/vue-consul/vue.config.js b/vue-consul/vue.config.js index 4856ed0..41f9fee 100644 --- a/vue-consul/vue.config.js +++ b/vue-consul/vue.config.js @@ -36,6 +36,15 @@ module.exports = { warnings: false, errors: true }, + + // 非nginx调试,使用代理后端模式。 + // proxy:{ + // 'api':{ + // target:'http://192.168.1.120:2026', + // changeOrigin: true, + // } + // }, + before: require('./mock/mock-server.js') }, configureWebpack: {