Commit acdb096d authored by 张烨's avatar 张烨

feat: update proxy match regexp

parent 5d43ab8c
...@@ -64,13 +64,13 @@ module.exports = function addDevMiddlewares(app, webpackConfig) { ...@@ -64,13 +64,13 @@ module.exports = function addDevMiddlewares(app, webpackConfig) {
const proxy2 = process.env.PROXY2; const proxy2 = process.env.PROXY2;
if (proxy2) { if (proxy2) {
const reg = /(\w+)\s+:\s+([\w:./]+)/; const reg = /([/\w]+)\s*:\s*([\w:./]*)/;
const match = proxy2.match(reg); const match = proxy2.match(reg);
const [, pre, host] = match; const [, pre, host] = match;
logger.info(`using proxy2 at: ${host}`); logger.info(`using proxy2 at: ${host}`);
logger.info(`proxy2 prefix: ${pre}`); logger.info(`proxy2 prefix: ${pre}`);
app.use( app.use(
`/${pre}`, `${pre.indexOf(0) === '/' ? pre : `/${pre}`}`,
createProxyMiddleware({ createProxyMiddleware({
target: host, target: host,
changeOrigin: true, changeOrigin: true,
......
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