zoukankan      html  css  js  c++  java
  • NODE代理,yang

    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');
    });
  • 相关阅读:
    [CTSC2017]吉夫特(Lucas定理,DP)
    [CTSC2017]游戏(Bayes定理,线段树)
    [BZOJ3551][ONTAK2010]Peaks(加强版)(Kruskal重构树,主席树)
    [BZOJ4337][BJOI2015]树的同构(树的最小表示法)
    [BZOJ3786]星系探索(伪ETT)
    [CTSC2017]密钥
    PKUSC2018训练日程(4.18~5.30)
    [NOI2016]优秀的拆分
    [SDOI2008]Sandy的卡片
    [JSOI2007]字符加密
  • 原文地址:https://www.cnblogs.com/ilovexiaoming/p/11840179.html
Copyright © 2011-2022 走看看