Skip to content

Instantly share code, notes, and snippets.

@sifu
Created August 30, 2012 14:15
Show Gist options
  • Save sifu/3529379 to your computer and use it in GitHub Desktop.
Save sifu/3529379 to your computer and use it in GitHub Desktop.
proxy http -> https (cloudant)
#!/usr/bin/env node
var httpProxy = require( 'http-proxy' );
var server = httpProxy.createServer( function( req, res, proxy ) {
proxy.proxyRequest( req, res, {
host: 'sifu.cloudant.com',
port: 443,
https: true
} );
} );
server.listen( 8000 );
// curl https://sifu.cloudant.com/test
// -> {"update_seq":"16-g1AAAADjeJzLYWBgYMl....
// curl http://localhost:8000/test
// -> An error has occurred: {"code":"ECONNRESET"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment