NODE代理,yang
2024-10-07 00:36:04
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');
});
最新文章
- 用scala实现一个sql执行引擎-(上)
- python 中偏函数 partial 的使用
- 如何部署Scrapy 到Scrapyd上?
- 互联网保险O2O平台微服务架构设计(转)
- Dos下查询关闭端口的命令例子
- iptables实战系列:通过NAT转发实现私网对外发布信息
- Python学习笔记 — 函数
- Subsequence Count (线段树)
- 【转载】Apache Spark Jobs 性能调优(二)
- C# - 为引用类型重定义相等性
- git增加子模块
- TCP的三次握手过程与四次挥手
- python发送邮件(在邮件中显示HTMLTestRunner生成的报告)
- Android Studio 使用本地gradle配置详解
- noip第23课资料
- 解决服务器代码执行mvn test后在classes和test-classes下找不到Spring的bean.xml配置文件问题
- 编译模块的Makefile解析
- DPDK无法分出大页面:EAL: No free hugepages reported in hugepages-2048kB 解决方法
- C++泛型和算法
- CentOS 6.9/7通过yum安装指定版本的Nginx
热门文章
- koa 基础(二十五)数据库 与 art-template 模板 联动 --- 新增数据
- ajax-php跨域请求
- FScapture录屏后导致麦克风无声问题
- css样式重置表
- 代码实现:当我们下载一个试用版软件,没有购买正版的时候,每执行一次就会提醒我们还有多少次使用机会用学过的IO流知识,模拟试用版软件,试用10次机会,执行一次就提示一次您还有几次机会,如果次数到了提示请购买正版
- css实现左侧固定宽度,右侧宽度自适应
- 【转】C++ 资源大全中文版
- AIxoder插件安装及使用
- Pythonnumpy提取矩阵的某一行或某一列的实例
- Django auth 用户验证