Commit a7a26393 authored by 张烨's avatar 张烨

feat: add second proxy

parent 4332da74
# PUBLIC_PATH = reactOMS
# PUBLIC_PATH = reactOMS, 默认转发 /cityinterface
PROXY = http://localhost:8005/
# 可设置第二个代理,test为转发前缀,后面为代理转发的地址
# PROXY2 = test : http://localhost:8006/
# 本地应用启动的host域名
HOST = localhost
# 本地应用启动的端口
PORT = 3001
\ No newline at end of file
......@@ -61,6 +61,30 @@ module.exports = function addDevMiddlewares(app, webpackConfig) {
},
}),
);
const proxy2 = process.env.PROXY2;
if (proxy2) {
const reg = /(\w+)\s+:\s+([\w:/]+)/;
const match = proxy2.match(reg);
const [, pre, host] = match;
logger.info(`using proxy2 at: ${host}`);
logger.info(`proxy2 prefix: ${pre}`);
app.use(
pre,
createProxyMiddleware({
target: host,
changeOrigin: true,
// eslint-disable-next-line no-unused-vars
onProxyReq: (_prexyReq, _req, _res) => {
logger.info('onProxyReq2');
},
// eslint-disable-next-line no-unused-vars
onProxyRes(_proxyRes, _req, _res) {
logger.info('onProxyRes2');
},
}),
);
}
}
app.get('*', (_req, res) => {
......
import React from 'react';
import { omit } from 'lodash';
import {
DatabaseOutlined,
UsergroupAddOutlined,
......@@ -21,7 +22,13 @@ import RoleManage from '../pages/userCenter/RoleManage';
import SiteManage from '../pages/userCenter/SiteManage';
// import DefaultComponent from '../pages/orgnazation/DefaultComponent';
import TestTable from '../pages/orgnazation/TestTable';
import { USER_MODE } from '@/utils/constants';
const iconStyle = { verticalAlign: '0.125em' };
const superAuthority = [USER_MODE.SUPER];
const adminAuthority = [...superAuthority, USER_MODE.ADMIN];
const commonAuthority = [...adminAuthority, USER_MODE.COMMON];
export default {
routes: [
{
......@@ -50,6 +57,7 @@ export default {
name: '数据库管理',
icon: <DatabaseOutlined style={iconStyle} />,
component: BlankLayout,
authority: adminAuthority,
routes: [
{
path: '/dbm/dbInit',
......@@ -67,6 +75,7 @@ export default {
path: '/userCenter',
name: '用户中心',
component: BlankLayout,
authority: commonAuthority,
icon: <UsergroupAddOutlined style={iconStyle} />,
routes: [
{
......@@ -97,6 +106,7 @@ export default {
component: BlankLayout,
name: '平台中心',
icon: <SettingOutlined style={iconStyle} />,
authority: commonAuthority,
routes: [
{
path: '/platformCenter/gis',
......@@ -135,6 +145,7 @@ export default {
component: BlankLayout,
name: '产品中心',
icon: <HomeOutlined style={iconStyle} />,
authority: commonAuthority,
routes: [
{
path: '/productCenter/web',
......@@ -158,6 +169,7 @@ export default {
component: BlankLayout,
name: '日志管理',
icon: <CopyOutlined style={iconStyle} />,
authority: commonAuthority,
routes: [
{
path: '/log',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment