cors-proxy-with-https
Advanced tools
Comparing version 1.0.23 to 1.0.24
@@ -32,14 +32,5 @@ const https = require('https') | ||
res.setHeader('Access-Control-Allow-Origin', '*') | ||
res.setHeader('Access-Control-Allow-Origin', '*'); | ||
res.setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS'); | ||
}) | ||
const server = httpProxy.createServer({ | ||
changeOrigin: true, | ||
target: this.config.target, | ||
agent: new https.Agent({ | ||
port: 443, | ||
...this.serverOptions | ||
}) | ||
}, (req, res, proxy) => { | ||
const server = httpProxy.createServer(this.serverOptions, (req, res) => { | ||
if (req.method === 'OPTIONS') { | ||
@@ -50,31 +41,11 @@ res.setHeader('Access-Control-Allow-Origin', '*') | ||
res.end() | ||
return; | ||
return | ||
} | ||
proxy.on('proxyRes', function(proxyRes, req, res) { | ||
res.setHeader('Access-Control-Allow-Origin', '*'); | ||
res.setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS'); | ||
}); | ||
proxy.web(req, res, { | ||
this.proxy.web(req, res, { | ||
target: this.config.target, | ||
secure: true | ||
}) | ||
}); | ||
}) | ||
// const server = https.createServer(this.serverOptions, (req, res) => { | ||
// if (req.method === 'OPTIONS') { | ||
// res.setHeader('Access-Control-Allow-Origin', '*') | ||
// res.setHeader('Access-Control-Allow-Headers', '*') | ||
// res.setHeader('Access-Control-Allow-Methods', '*') | ||
// res.end() | ||
// return | ||
// } | ||
// | ||
// this.proxy.web(req, res, { | ||
// target: this.config.target, | ||
// secure: true | ||
// }) | ||
// }) | ||
server.listen(this.config.port, this.config.host) | ||
@@ -81,0 +52,0 @@ } |
{ | ||
"name": "cors-proxy-with-https", | ||
"description": "Прокси для обхода CORS + поддержка HTTPS by devmkru", | ||
"version": "1.0.23", | ||
"version": "1.0.24", | ||
"main": "./lib", | ||
@@ -6,0 +6,0 @@ "bin": { |
5086
84