var url = require("url");
var proxy = require('http-proxy').createProxyServer({});
// 自定义路由分发规则,从前向后匹配
var rules = [
['Static', 'http://localhost:8080', /.*\.(js|css|htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma|ico)$/],
['Index', 'http://localhost:8080', /^\/$/],
['Backend', 'http://10.10.102.7:8083', /\/.+/]
];
var server = require('http').createServer(function(req, res) {
// var host = req.headers.host, ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
// console.log("Raw - client ip:" + ip + ", host:" + host + ");
var path = url.parse(req.url).pathname;
// 请求的路径 比如“'http://localhost:3000 /sho
var proxy = require('http-proxy').createProxyServer({});
// 自定义路由分发规则,从前向后匹配
var rules = [
['Static', 'http://localhost:8080', /.*\.(js|css|htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma|ico)$/],
['Index', 'http://localhost:8080', /^\/$/],
['Backend', 'http://10.10.102.7:8083', /\/.+/]
];
var server = require('http').createServer(function(req, res) {
// var host = req.headers.host, ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
// console.log("Raw - client ip:" + ip + ", host:" + host + ");
var path = url.parse(req.url).pathname;
// 请求的路径 比如“'http://localhost:3000 /sho