const express = require('express');
const proxy = require('http-proxy-middleware');//引入代理中间件
const app = express();
app.use(express.static('webapp')); // 测试
const host = 'http://192.168.0.232:8382';//192.168.0.232:8382/ // 本地
// const host = 'http://localhost:8091/';
// const host = 'http://192.168.6.108:80/'; // Add middleware for http proxying
//将服务器代理
const appProxy = proxy(
'/app/', {
target: host,
changeOrigin: true,
pathRewrite: {
'^/': '/'
}
});
const drawProxy= proxy(
'/draw/', {
target: 'http://120.24.168.179:8081',
changeOrigin: true,
pathRewrite: {
'^/': '/'
}
});
const gatewayProxy= proxy(
'/gateway/', {
// target: 'http://119.23.175.96:6001',
target: 'http://192.168.0.238:6001',
changeOrigin: true,
pathRewrite: {
'^/gateway': '/'
}
});
const thirdPartyProxy= proxy(
'/third-party/', {
target: 'http://192.168.0.242:8050',
// target: 'http://m.ibaboss.com/',
changeOrigin: true,
pathRewrite: {
'^/': '/'
}
});
app.use('/app/*', appProxy);//洋老板代理
app.use('/draw/*', drawProxy);//营销系统代理
app.use('/gateway/*', gatewayProxy);//秒杀代理
app.use('/third-party/*', thirdPartyProxy);//代理 // Render your site
app.get('/index.htm', function (req, res) {
res.sendFile(__dirname + '/src/index.html');
}); app.listen(8099, () => {
console.log('Listening on: http://localhost:8083');
});

最新文章

  1. 用scala实现一个sql执行引擎-(上)
  2. python 中偏函数 partial 的使用
  3. 如何部署Scrapy 到Scrapyd上?
  4. 互联网保险O2O平台微服务架构设计(转)
  5. Dos下查询关闭端口的命令例子
  6. iptables实战系列:通过NAT转发实现私网对外发布信息
  7. Python学习笔记 — 函数
  8. Subsequence Count (线段树)
  9. 【转载】Apache Spark Jobs 性能调优(二)
  10. C# - 为引用类型重定义相等性
  11. git增加子模块
  12. TCP的三次握手过程与四次挥手
  13. python发送邮件(在邮件中显示HTMLTestRunner生成的报告)
  14. Android Studio 使用本地gradle配置详解
  15. noip第23课资料
  16. 解决服务器代码执行mvn test后在classes和test-classes下找不到Spring的bean.xml配置文件问题
  17. 编译模块的Makefile解析
  18. DPDK无法分出大页面:EAL: No free hugepages reported in hugepages-2048kB 解决方法
  19. C++泛型和算法
  20. CentOS 6.9/7通过yum安装指定版本的Nginx

热门文章

  1. koa 基础(二十五)数据库 与 art-template 模板 联动 --- 新增数据
  2. ajax-php跨域请求
  3. FScapture录屏后导致麦克风无声问题
  4. css样式重置表
  5. 代码实现:当我们下载一个试用版软件,没有购买正版的时候,每执行一次就会提醒我们还有多少次使用机会用学过的IO流知识,模拟试用版软件,试用10次机会,执行一次就提示一次您还有几次机会,如果次数到了提示请购买正版
  6. css实现左侧固定宽度,右侧宽度自适应
  7. 【转】C++ 资源大全中文版
  8. AIxoder插件安装及使用
  9. Pythonnumpy提取矩阵的某一行或某一列的实例
  10. Django auth 用户验证