mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[fix] proxying to https
This commit is contained in:
parent
3c91ed3d26
commit
26c4c43a06
@ -86,14 +86,14 @@ function XHeaders(req, res, options) {
|
||||
|
||||
function stream(req, res, options) {
|
||||
if(options.forward) {
|
||||
var forwardReq = (options.ssl ? https : http).request(
|
||||
var forwardReq = (options.target.protocol === 'https:' ? https : http).request(
|
||||
common.setupOutgoing(options.ssl || {}, options, req, 'forward')
|
||||
);
|
||||
req.pipe(forwardReq);
|
||||
return res.end();
|
||||
}
|
||||
|
||||
var proxyReq = (options.ssl ? https : http).request(
|
||||
var proxyReq = (options.target.protocol === 'https:' ? https : http).request(
|
||||
common.setupOutgoing(options.ssl || {}, options, req)
|
||||
);
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ function XHeaders(req, socket, options) {
|
||||
*/
|
||||
function stream(req, socket, options, head) {
|
||||
common.setupSocket(socket);
|
||||
|
||||
console.log(options.target.protocol);
|
||||
var proxyReq = (~['https:', 'wss:'].indexOf(options.target.protocol) ? https : http).request(
|
||||
common.setupOutgoing(options.ssl || {}, options, req)
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user