The almost same code works fine for me (httpsConfig should not have this comma in the second line however and I'm using a key file, not a pem file but it should be the same ...).

<23:26:13>stephanerios@localhost ~/Sites/tmp (master) ?   ls stephanerios.*
-rw-r--r--  1 stephanerios  staff  855 26 avr 23:10 stephanerios.cer
-rw-r--r--  1 stephanerios  staff  810 26 avr 23:17 stephanerios.crt
-rw-r--r--  1 stephanerios  staff  631 26 avr 23:17 stephanerios.csr
-rw-r--r--  1 stephanerios  staff  963 26 avr 23:16 stephanerios.key

<23:26:21>stephanerios@localhost ~/Sites/tmp (master) ?   cat https.js
var http = require("http"),
    https = require("https"),
    httpProxy = require("http-proxy"),
    fs = require('fs');

var httpsConfig = {
  key: fs.readFileSync('./stephanerios.key'),
  cert: fs.readFileSync('./stephanerios.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);


<23:26:50>stephanerios@localhost ~/Sites/tmp (master) ?   sudo node https.js
Enter PEM pass phrase:
Enter PEM pass phrase:

<23:26:53>stephanerios@localhost ~/Sites/tmp (master) ? curl -k https://localhost
hello https
<23:27:08>stephanerios@localhost ~/Sites/tmp (master) ? curl -k https://localhost:8000
hello https

I've generated key & cert files with these instructions : http://superuser.com/questions/73979/how-to-easily-create-a-ssl-certificate-and-configure-it-in-apache2-in-mac-os-x

Don't know if this can help

Le 25/04/13 18:05, Jack O'Sullivan a écrit :

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.



--
Stéphane RIOS - +33 6 30 26 44 80 - @fasterize <http://twitter.com/stefounet> - skype:stephane_rios CEO fasterize.com <http://www.fasterize.com/?utm_source=sig&utm_medium=mail&utm_campaign=>
Make It Fast, Keep It Fast

--
--
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.


Reply via email to