Skip to content

Instantly share code, notes, and snippets.

@jviveiros
Created March 31, 2018 00:59
Show Gist options
  • Save jviveiros/bbb8ae0399a18f67d76170850ab83370 to your computer and use it in GitHub Desktop.
Save jviveiros/bbb8ae0399a18f67d76170850ab83370 to your computer and use it in GitHub Desktop.
Node Example
const unirest = require('unirest');
var fs = require('fs');
const username = process.env.FORWARD_HTTP_PROXY_USERNAME;
const password = process.env.FORWARD_HTTP_PROXY_PASSWORD;
const forward_proxy = process.env.FORWARD_HTTP_PROXY_HOST;
const reverse_proxy = process.env.REVERSE_HTTP_PROXY_HOST;
function reveal_via_forward_proxy(tokenized_value) {
return new Promise((rs, rj) => {
const proxy = `http://${username}:${password}@${forward_proxy}`;
let post = unirest.post('https://httpbin.verygoodsecurity.io/post')
.headers({
'Content-Type': 'application/json'
})
.proxy(proxy);
post.options.ca = fs.readFileSync('cert.pem');
post.send(tokenized_value)
.end(function (response) {
rs(response.body.data);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment