Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var http = require('http'),
- fs = require('fs'),
- connect = require('connect'),
- httpProxy = require('http-proxy'),
- proxy = httpProxy.createProxyServer({});
- proxy.on('proxyReq', function (proxyReq, req, res, options) {
- if (req.headers['content-type']==='text/xml') {
- // send it to target and also forward to another server
- }
- });
- var app = connect()
- .use(function (req, res) {
- proxy.web(req, res,
- {
- target: {
- port: 8081,
- host: 'localhost'
- }
- })
- });
- http.createServer(app).listen(8080, function () {
- console.log('proxy listen 8080');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement