Skip to content

Instantly share code, notes, and snippets.

@tralamazza
Created July 26, 2011 15:37
Show Gist options
  • Save tralamazza/1107045 to your computer and use it in GitHub Desktop.
Save tralamazza/1107045 to your computer and use it in GitHub Desktop.
(http - https) proxy rapleaf
var http = require('http'),
httpProxy = require('http-proxy');
var proxy = new httpProxy.HttpProxy();
proxy.on('proxyError', function(err, req, res) {
console.log('proxy.error: ' + err);
});
proxy.on('end', function(req, res) {
console.log('proxy.end');
});
http.createServer(function(req, res) {
proxy.proxyRequest(req, res, {
host: 'personalize.rapleaf.com',
port: 443,
https: true
});
}).listen(8000);
@tralamazza
Copy link
Author

$ curl -v "http://localhost:8000/v4/dr?first=John&last=Doe&email=personalize%40example.com&api_key=78ad9ddc21e3c220cc5da024b6dbe13"

@tralamazza
Copy link
Author

Strangely if you submit the request directly
curl -v "https://personalize.rapleaf.com/v4/dr?first=John&last=Doe&email=personalize%40example.com&api_key=78ad9ddc21e3c220cc5da024b6dbe13" the Content-Length is present.

@dominictarr
Copy link

thats a clue! so it sounds like nhp is removing the Content-Length header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment