shp

seafish-http-proxy-meteor

A full-featured http proxy for node.js

Showing:

Popularity

Downloads/wk

0

GitHub Stars

7

Maintenance

Last Commit

8yrs ago

Contributors

69

Package

Dependencies

4

Size (min+gzip)

23.3KB

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

forked from nodejitsu/node-http-proxy

Add ability to change response script and link relative url when proxy

Add this ability for meteor in this moment (version 0.6.4 still not support ROOT_URL, so I change proxy code to avoid this problem)

This is forked from master, and until now, websocket can not pass through if use node 0.10.X This works fine with websocket under node 0.8.17 which I used now

n is a great node version maintain tool

normal usage:

var httpProxy = require('seafish-http-proxy-meteor');

var options = {
  replaceRelativePath: true,
  pathnameOnly: true,
  router: {
    '/wiki': '127.0.0.1:8001',
    '/blog': '127.0.0.1:8002/blog',
    '/api':  '127.0.0.1:8003'
  }
}

var proxyServer = httpProxy.createServer(options);
proxyServer.listen(80);

meteor usage: before 0.6.6.1

var httpProxy = require('seafish-http-proxy-meteor');

var options = {
  replaceRelativePath: true,
  pathnameOnly: true,
  router: {
    '/meteor': '127.0.0.1:3000',
    '/sockjs': '127.0.0.1:3000/sockjs',
    '/otherapp': '127.0.0.1:8002'
  }
}

var proxyServer = httpProxy.createServer(options);
proxyServer.listen(80);

meteor usage: after 0.6.6.1

// suppose ROOT_URL is "localhost:3000/meteor"
var httpProxy = require('seafish-http-proxy-meteor');

var options = {
  pathnameOnly: true,
  router: {
    '/meteor': '127.0.0.1:3000/meteor',
    '/otherapp': '127.0.0.1:8002'
  }
}

var proxyServer = httpProxy.createServer(options);
proxyServer.listen(80);

Simple use

// suppose ROOT_URL is "localhost:3000"
var httpProxy = require('seafish-http-proxy-meteor');

var options = {
  pathnameOnly: true,
  router: {
    '/otherapp': '127.0.0.1:8002',
    '/': '127.0.0.1:3000/',
  }
}

var proxyServer = httpProxy.createServer(options);
proxyServer.listen(80);

Use with https

// suppose ROOT_URL is "localhost:3000"
var httpProxy = require('seafish-http-proxy-meteor');

var options = {
  pathnameOnly: true,
  router: {
    '/otherapp': '127.0.0.1:8002',
    '/': '127.0.0.1:3000/',
  },
  https: {
    key: "",
    cert: ""
  }
}

var proxyServer = httpProxy.createServer(options);
proxyServer.listen(443);

The replaceRelativePath option, work for html page, change things like

<script src="/test.js"></script>

into

<script src="/path/test.js"></script>

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial