Created
March 31, 2018 00:59
Node Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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