I would like to create a proxy for HTTPS connections with Node.js. I am
using the http-proxy <https://github.com/nodejitsu/node-http-proxy> library,
which works well. I can get a HTTP proxy to work perfectly, but when I try
HTTPS, the request to the proxy just times out. Here is my code (a slightly
modified version of the node-http-proxy
proxy-https-to-https<https://github.com/nodejitsu/node-http-proxy/blob/master/examples/http/proxy-https-to-https.js>
example):
var http = require("http"),
https = require("https"),
httpProxy = require("http-proxy"),
fs = require('fs');
var httpsConfig = {
key: fs.readFileSync('./jackos2500-key.pem'),
cert: fs.readFileSync('./jackos2500-cert.crt'),};
https.createServer(httpsConfig, function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.write('hello https\n');
res.end();}).listen(8000);
httpProxy.createServer(8000, 'localhost', {
https: httpsConfig,
target: {
https: true,
rejectUnauthorized: false
}}).listen(443);
Is there something obvious I'm missing here or is there some other issue?
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.