Skip to content

benderjs/benderjs-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

benderjs-proxy

HTTP proxy for Bender.js using node-http-proxy. Especially useful for testing Cross-Origin requests.

Installation

npm install benderjs-proxy

Usage

Add benderjs-proxy to the plugins array in your bender.js configuration file:

var config = {
	plugins: [ 'benderjs-proxy' ] // load the plugin
};

module.exports = config;

Configuration

You can configure proxy in bender.js configuration file.

var config = {
    (...)

	proxy: {
		// Below configuration will redirect all requests from http://<bender_host>:<bender_port>/google to http://google.com
		'/google': 'http://google.com',
		
        // You can also pass a function as a proxy target, it will receive a URL object produced using Node's url.parse() method
		'/foobar': function( url ) {
			return 'http://example.com/foo/bar' + ( url.search || '' );
		}
	}
};

module.exports = config;

License

MIT, for license details see: LICENSE.md.

About

HTTP proxy for Bender.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •