mirror of
https://github.com/d0zingcat/cors-anywhere.git
synced 2026-05-13 15:09:25 +00:00
Add httpsOptions option to create https.Server
Note: This does not work with the current version of node-http-proxy and node 0.12.0 because req.connection.pair is not defined.
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
'use strict';
|
||||
/* jshint node:true, eqnull:true, sub:true, quotmark:single, unused:true */
|
||||
|
||||
var http = require('http');
|
||||
var httpProxy = require('http-proxy');
|
||||
var net = require('net');
|
||||
var url = require('url');
|
||||
@@ -308,7 +307,13 @@ exports.createServer = function createServer(options) {
|
||||
}
|
||||
|
||||
var proxy = httpProxy.createServer(httpProxyOptions);
|
||||
var server = http.createServer(getHandler(options, proxy));
|
||||
var requestHandler = getHandler(options, proxy);
|
||||
var server;
|
||||
if (options.httpsOptions) {
|
||||
server = require('https').createServer(options.httpsOptions, requestHandler);
|
||||
} else {
|
||||
server = require('http').createServer(requestHandler);
|
||||
}
|
||||
|
||||
// When the server fails, just show a 404 instead of Internal server error
|
||||
proxy.on('error', function(err, req, res) {
|
||||
|
||||
Reference in New Issue
Block a user